:root {
  --navy-950: #061827;
  --navy-900: #082238;
  --navy-800: #0c304d;
  --navy-700: #164766;
  --blue-600: #086ad8;
  --blue-500: #1479eb;
  --aqua-500: #25c9b9;
  --aqua-100: #dff7f3;
  --aqua-50: #effbf9;
  --ink: #0a2740;
  --muted: #61778a;
  --line: #d7e3ea;
  --line-strong: #bfd0da;
  --paper: #ffffff;
  --wash: #f4f8fa;
  --warning: #9c3d31;
  --warning-bg: #fff1ef;
  --success: #087b6e;
  --shadow: 0 24px 60px rgba(5, 25, 41, 0.13);
  --radius-lg: 20px;
  --radius-md: 12px;
  --container: 1460px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--wash);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.container {
  width: min(var(--container), calc(100% - 72px));
  margin-inline: auto;
}

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

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 15px;
  color: var(--paper);
  background: var(--blue-600);
  border-radius: 6px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid #49d6c8;
  outline-offset: 3px;
}

.site-header {
  min-height: 68px;
  color: #eaf5fb;
  background: var(--navy-950);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-wrap {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 34px;
}

.brand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--paper);
  font-size: 19px;
  font-weight: 760;
  letter-spacing: -0.025em;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 39px;
  height: 31px;
  color: var(--paper);
  background: var(--blue-600);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.brand-dot {
  color: var(--aqua-500);
}

.nav-wrap nav {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
}

.nav-wrap nav a {
  color: #c6d6e0;
  font-size: 14px;
  font-weight: 630;
  text-decoration: none;
}

.nav-wrap nav a:hover {
  color: var(--paper);
}

.verified {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.verified i,
.status-dot {
  width: 7px;
  height: 7px;
  background: var(--aqua-500);
  border-radius: 50%;
}

.utility-intro {
  color: var(--paper);
  background: var(--navy-950);
}

.utility-intro-row {
  min-height: 134px;
  display: grid;
  grid-template-columns: minmax(250px, 0.62fr) minmax(460px, 1.2fr) auto;
  align-items: center;
  gap: 42px;
}

.utility-intro h1 {
  margin: 6px 0 0;
  font-size: clamp(32px, 3vw, 48px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.utility-intro-row > p {
  max-width: 690px;
  margin: 0;
  color: #c5d5df;
  font-size: 17px;
}

.eyebrow {
  margin: 0;
  color: var(--blue-600);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.utility-intro .eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #8ee5dc;
}

.ruleset-chip,
.fca-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: 999px;
  font-weight: 750;
}

.ruleset-chip {
  padding: 8px 12px;
  color: #b9eee9;
  background: rgba(37, 201, 185, 0.1);
  border: 1px solid rgba(81, 221, 208, 0.32);
  font-size: 12px;
}

.workbench-section {
  padding: 34px 0 42px;
}

.workbench-shell {
  min-height: 760px;
  display: grid;
  grid-template-columns: minmax(350px, 0.76fr) minmax(650px, 1.48fr);
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.input-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 26px;
  background: var(--paper);
  border-right: 1px solid var(--line);
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: #edf3f6;
  border-radius: 10px;
}

.mode-tab,
.result-tab {
  border: 0;
  font-weight: 760;
}

.mode-tab {
  min-height: 43px;
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
  border-radius: 7px;
  font-size: 14px;
}

.mode-tab.active {
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 2px 9px rgba(6, 24, 39, 0.09);
}

.mode-panel {
  padding-top: 30px;
}

.panel-heading h3,
.result-view-heading h3,
.mifir-controls h3 {
  margin: 6px 0 7px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.18;
  letter-spacing: -0.025em;
}

.panel-heading > p:last-child,
.result-view-heading > span {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.lookup-form {
  margin-top: 25px;
}

.lookup-form label,
.field-row > label,
.attribute-label {
  display: block;
  margin-bottom: 7px;
  color: #2b465b;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.lookup-row input,
select {
  width: 100%;
  min-height: 48px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.lookup-row input {
  min-width: 0;
  padding: 0 14px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lookup-row input::placeholder {
  color: #91a4b2;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

select {
  padding: 0 39px 0 12px;
  font-size: 14px;
  font-weight: 650;
}

.button {
  min-height: 42px;
  padding: 0 17px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 780;
}

.button-primary {
  color: var(--paper);
  background: var(--blue-600);
  border: 1px solid var(--blue-600);
}

.button-primary:hover:not(:disabled) {
  background: #075dbd;
}

.button-outline {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-strong);
}

.lookup-status,
.copy-status,
.mifir-action-status {
  min-height: 20px;
  margin: 8px 0 0;
  font-size: 12px;
}

.lookup-status.success,
.copy-status,
.mifir-action-status {
  color: var(--success);
}

.lookup-status.error {
  color: var(--warning);
}

.quick-examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding-top: 19px;
  margin-top: 13px;
  border-top: 1px solid var(--line);
}

.quick-examples span {
  margin-right: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.quick-examples button {
  padding: 5px 9px;
  color: var(--blue-600);
  background: #edf5ff;
  border: 1px solid #cfe3fb;
  border-radius: 5px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
}

.field-row {
  margin-top: 20px;
}

.field-row-primary {
  margin-top: 26px;
}

.field-help {
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
}

.attribute-fields {
  display: grid;
  gap: 15px;
  margin-top: 22px;
  padding-top: 21px;
  border-top: 1px solid var(--line);
}

.attribute-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.position {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--blue-600);
  background: #e8f2ff;
  border-radius: 5px;
  font-size: 11px;
}

.selected-definition {
  overflow-wrap: anywhere;
}

.privacy-note {
  display: flex;
  gap: 9px;
  padding: 13px 14px;
  margin-top: auto;
  color: #436174;
  background: var(--aqua-50);
  border: 1px solid #ccece7;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.4;
}

.privacy-note > span {
  color: var(--success);
  font-weight: 900;
}

.privacy-note p {
  margin: 0;
}

.results-workspace {
  min-width: 0;
  padding: 27px;
  background: var(--navy-950);
}

.classification-card {
  padding: 24px;
  background: #f8fbfc;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.code-card-header,
.result-classification,
.result-actions,
.result-view-heading,
.mifir-match,
.mifir-toolbar,
.footer-wrap {
  display: flex;
  align-items: center;
}

.code-card-header {
  justify-content: space-between;
  color: #416076;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.verified {
  color: var(--success);
}

.verified.invalid {
  color: var(--warning);
}

.code-pills {
  display: grid;
  grid-template-columns: repeat(6, minmax(54px, 1fr));
  gap: 10px;
  margin-top: 21px;
}

.code-pills span {
  display: grid;
  place-items: center;
  min-height: 74px;
  color: var(--ink);
  background: #dff4f1;
  border-radius: 8px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: clamp(25px, 2.5vw, 36px);
  font-weight: 900;
}

.code-pills span:nth-child(-n + 2) {
  color: var(--paper);
  background: var(--blue-600);
}

.result-classification {
  gap: 12px;
  margin-top: 18px;
  color: #5f7789;
  font-size: 13px;
}

.result-classification i {
  flex: 1;
  border-top: 1px dashed #b9cad4;
}

.result-classification strong {
  color: var(--ink);
  text-align: right;
}

.result-actions {
  min-height: 44px;
  gap: 8px;
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.copy-status {
  margin: 0 0 0 4px;
}

.result-tabs {
  display: flex;
  align-items: end;
  gap: 4px;
  margin-top: 24px;
}

.result-tab {
  min-height: 48px;
  padding: 0 20px;
  color: #a9c0cf;
  background: transparent;
  border-radius: 8px 8px 0 0;
  font-size: 14px;
}

.result-tab.active {
  color: var(--ink);
  background: var(--paper);
}

.fca-pill {
  padding: 2px 6px;
  margin-left: 5px;
  color: #075f56;
  background: #c9f1ec;
  font-size: 9px;
  letter-spacing: 0.05em;
}

.result-view {
  min-height: 375px;
  padding: 24px;
  background: var(--paper);
  border-radius: 0 10px 10px 10px;
}

.result-view-heading {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.result-view-heading > span {
  text-align: right;
}

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

.definition-card {
  min-width: 0;
  overflow: hidden;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.definition-card[open] {
  background: var(--paper);
  border-color: #abc7d7;
  box-shadow: 0 5px 14px rgba(5, 33, 52, 0.07);
}

.definition-card summary {
  min-height: 70px;
  display: grid;
  grid-template-columns: 39px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.definition-card summary::-webkit-details-marker {
  display: none;
}

.definition-card summary > code {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--blue-600);
  background: #e6f1ff;
  border-radius: 6px;
  font-size: 17px;
  font-weight: 900;
}

.definition-card summary span {
  min-width: 0;
}

.definition-card summary small,
.definition-card summary b {
  display: block;
}

.definition-card summary small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.definition-card summary b {
  overflow: hidden;
  margin-top: 3px;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.definition-card summary i {
  color: #6c8597;
  font-style: normal;
  font-size: 18px;
  text-align: center;
  transition: transform 160ms ease;
}

.definition-card[open] summary i {
  transform: rotate(45deg);
}

.definition-card > p {
  padding: 0 13px 13px 63px;
  margin: -2px 0 0;
  color: #526b7e;
  font-size: 12px;
  line-height: 1.5;
}

.mifir-controls {
  display: grid;
  grid-template-columns: minmax(205px, 0.58fr) minmax(360px, 1fr);
  gap: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.scenario-fieldset {
  display: grid;
  gap: 7px;
  padding: 0;
  margin: 0;
  border: 0;
}

.scenario-option {
  position: relative;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 11px;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.scenario-option:has(input:checked) {
  background: #eef7ff;
  border-color: #8abbea;
}

.scenario-option input {
  margin: 4px 0 0;
  accent-color: var(--blue-600);
}

.scenario-option strong,
.scenario-option small {
  display: block;
}

.scenario-option strong {
  color: var(--ink);
  font-size: 12px;
}

.scenario-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.mifir-match {
  justify-content: space-between;
  gap: 18px;
  padding: 17px 0 12px;
}

.mifir-match > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mifir-match code,
.mifir-match > span code {
  color: var(--blue-600);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 850;
}

.mifir-match > div > code {
  padding: 5px 8px;
  background: #e9f3ff;
  border-radius: 5px;
  font-size: 13px;
}

.mifir-match strong {
  font-size: 13px;
}

.mifir-match > span {
  color: var(--muted);
  font-size: 11px;
}

.status-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  background: #f6f9fa;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.status-summary > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
}

.status-summary > div:last-child {
  border-right: 0;
}

.status-summary strong {
  font-size: 21px;
  line-height: 1;
}

.status-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
}

.mifir-toolbar {
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 10px;
}

.filter-buttons,
.mifir-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-buttons button,
.mifir-actions button {
  min-height: 31px;
  padding: 0 10px;
  color: #38566b;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 780;
}

.filter-buttons button[aria-pressed="true"] {
  color: var(--paper);
  background: var(--navy-800);
  border-color: var(--navy-800);
}

.mifir-actions button {
  color: var(--blue-600);
  border-color: #bad6f3;
}

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

.field-status-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.field-status-table th,
.field-status-table td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid #e3ebef;
}

.field-status-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #4e687b;
  background: #f2f6f8;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.field-status-table th:first-child,
.field-status-table td:first-child {
  width: 64px;
  font-weight: 820;
}

.field-status-table th:last-child,
.field-status-table td:last-child {
  width: 150px;
}

.field-status-table tbody tr:last-child td {
  border-bottom: 0;
}

.status {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 820;
  letter-spacing: 0.02em;
}

.status-m {
  color: #075c52;
  background: #d5f3ef;
}

.status-o {
  color: #295d97;
  background: #e3f0ff;
}

.status-na {
  color: #617485;
  background: #e9eff2;
}

.mifir-disclaimer {
  margin: 13px 0 0;
  color: #6a7f8f;
  font-size: 10px;
}

.mifir-disclaimer a {
  color: var(--blue-600);
  font-weight: 700;
}

.mifir-action-status {
  min-height: 0;
}

.not-applicable-panel,
.result-error {
  padding: 20px;
  margin-top: 18px;
  border-radius: 9px;
}

.not-applicable-panel {
  display: flex;
  align-items: center;
  gap: 18px;
  color: #305f66;
  background: var(--aqua-50);
  border: 1px solid #bee6e1;
}

.not-applicable-panel .summary-number {
  display: grid;
  place-items: center;
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  color: var(--success);
  background: var(--paper);
  border-radius: 10px;
  font-size: 28px;
  font-weight: 850;
}

.not-applicable-panel p,
.result-error p {
  margin: 4px 0 0;
  font-size: 12px;
}

.result-error {
  grid-column: 1 / -1;
  color: var(--warning);
  background: var(--warning-bg);
  border: 1px solid #f0cac4;
}

.resource-strip {
  padding: 35px 0 42px;
  background: var(--paper);
  border-top: 1px solid var(--line);
}

.resource-grid {
  display: grid;
  grid-template-columns: 0.8fr repeat(5, 1fr);
  gap: 22px;
  align-items: stretch;
}

.resource-grid h2 {
  margin: 6px 0 0;
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.resource-grid > a {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 105px;
  padding: 16px;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.resource-grid > a:hover {
  border-color: #88badd;
  box-shadow: 0 7px 18px rgba(5, 33, 52, 0.07);
}

.resource-grid > a strong {
  font-size: 14px;
}

.resource-grid > a span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.resource-grid > a b {
  color: var(--blue-600);
}

.site-footer {
  color: #a9bdc9;
  background: var(--navy-950);
}

.footer-wrap {
  min-height: 94px;
  gap: 28px;
}

.brand-footer {
  font-size: 16px;
}

.brand-footer .brand-mark {
  width: 34px;
  height: 28px;
  font-size: 10px;
}

.footer-wrap p {
  margin: 0;
  font-size: 11px;
}

.footer-wrap p:last-child {
  margin-left: auto;
}

/* Reference pages */
.article-hero {
  padding: 66px 0 58px;
  color: var(--paper);
  background: var(--navy-950);
}

.article-hero .eyebrow {
  color: #8ee5dc;
}

.article-hero h1 {
  max-width: 920px;
  margin: 10px 0 18px;
  font-size: clamp(40px, 5vw, 66px);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.article-hero p:last-child {
  max-width: 720px;
  margin: 0;
  color: #bfd0db;
  font-size: 18px;
}

.article-layout {
  display: grid;
  grid-template-columns: 235px minmax(0, 760px);
  gap: 62px;
  justify-content: center;
  padding-top: 58px;
  padding-bottom: 72px;
}

.article-nav {
  align-self: start;
  position: sticky;
  top: 28px;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.article-nav strong {
  display: block;
  margin-bottom: 11px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-nav a {
  display: block;
  padding: 6px 0;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.article-nav a:hover {
  color: var(--blue-600);
}

.article-content {
  min-width: 0;
}

.article-content section + section {
  padding-top: 44px;
  margin-top: 44px;
  border-top: 1px solid var(--line);
}

.article-content h2 {
  margin: 0 0 14px;
  font-size: 30px;
  line-height: 1.16;
  letter-spacing: -0.035em;
}

.article-content h3 {
  margin: 28px 0 8px;
  font-size: 19px;
}

.article-content p,
.article-content li {
  color: #405d70;
}

.article-content a {
  color: var(--blue-600);
  font-weight: 680;
}

.article-content table {
  width: 100%;
  margin: 24px 0;
  border-collapse: collapse;
  background: var(--paper);
  border: 1px solid var(--line);
}

.article-content th,
.article-content td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.article-content th {
  color: #415c6f;
  background: #edf3f6;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.article-content code {
  color: var(--blue-600);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 800;
}

.article-note,
.article-cta {
  padding: 22px;
  margin: 25px 0;
  border-radius: 10px;
}

.article-note {
  background: var(--aqua-50);
  border: 1px solid #c7eae5;
}

.article-note p {
  margin: 0;
}

.article-cta {
  color: var(--paper);
  background: var(--navy-900);
}

.article-cta h2,
.article-cta p {
  color: var(--paper);
}

.article-cta .button {
  display: inline-flex;
  color: var(--paper);
  align-items: center;
  margin-top: 8px;
  text-decoration: none;
}

@media (max-width: 1100px) {
  .container {
    width: min(100% - 40px, var(--container));
  }

  .utility-intro-row {
    grid-template-columns: auto 1fr;
    gap: 28px;
  }

  .ruleset-chip {
    display: none;
  }

  .workbench-shell {
    grid-template-columns: minmax(320px, 0.72fr) minmax(520px, 1.28fr);
  }

  .code-pills {
    gap: 7px;
  }

  .mifir-controls {
    grid-template-columns: 1fr;
  }

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

  .resource-grid > div {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .nav-wrap nav a:not(:first-child) {
    display: none;
  }

  .utility-intro-row,
  .workbench-shell,
  .article-layout {
    grid-template-columns: 1fr;
  }

  .utility-intro-row {
    gap: 12px;
    padding: 28px 0;
  }

  .workbench-shell {
    min-height: 0;
  }

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

  .privacy-note {
    margin-top: 28px;
  }

  .article-nav {
    display: none;
  }
}

@media (max-width: 620px) {
  .container {
    width: min(100% - 24px, var(--container));
  }

  .workbench-section {
    padding-top: 12px;
  }

  .workbench-shell {
    border-radius: 11px;
  }

  .input-panel,
  .results-workspace,
  .classification-card,
  .result-view {
    padding: 17px;
  }

  .lookup-row {
    grid-template-columns: 1fr;
  }

  .code-pills {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
  }

  .code-pills span {
    min-height: 50px;
    font-size: 21px;
  }

  .definition-grid,
  .resource-grid,
  .status-summary {
    grid-template-columns: 1fr;
  }

  .status-summary > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .status-summary > div:last-child {
    border-bottom: 0;
  }

  .result-view-heading,
  .mifir-match,
  .mifir-toolbar,
  .footer-wrap {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-view-heading > span {
    text-align: left;
  }

  .mifir-match > div {
    align-items: flex-start;
    flex-direction: column;
  }

  .field-status-table th:last-child,
  .field-status-table td:last-child {
    width: auto;
  }

  .resource-grid {
    gap: 12px;
  }

  .footer-wrap {
    justify-content: center;
    padding: 24px 0;
  }

  .footer-wrap p:last-child {
    margin-left: 0;
  }

  .article-hero {
    padding: 44px 0;
  }

  .article-layout {
    padding-top: 38px;
  }
}

.scenario-hero {
  color: var(--paper);
  background: var(--navy-950);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.scenario-hero-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 56px;
  padding: 48px 0;
}

.scenario-hero h1 {
  max-width: 850px;
  margin: 4px 0 12px;
  font-size: clamp(36px, 4vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.048em;
}

.scenario-hero p:not(.eyebrow) {
  max-width: 820px;
  margin: 0;
  color: #bdd0dc;
  font-size: 17px;
}

.scenario-version {
  flex: 0 0 305px;
  padding: 18px 20px;
  color: var(--ink);
  background: var(--aqua-100);
  border-radius: 10px;
}

.scenario-version strong,
.scenario-version span,
.scenario-version small {
  display: block;
}

.scenario-version strong {
  margin-bottom: 5px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.scenario-version span {
  font-weight: 750;
}

.scenario-version small {
  margin-top: 7px;
  color: #456779;
  line-height: 1.4;
}

.scenario-preset-strip {
  padding: 28px 0 30px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.preset-heading-row,
.workspace-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.preset-heading-row h2,
.workspace-heading-row h2,
.deck-heading h2 {
  margin: 3px 0 0;
  font-size: 23px;
  letter-spacing: -0.025em;
}

.text-button {
  padding: 0;
  color: var(--blue-600);
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.preset-list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 17px;
  min-height: 186px;
}

.preset-card {
  min-height: 88px;
  padding: 14px;
  text-align: left;
  color: var(--ink);
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.preset-card:hover {
  background: var(--aqua-50);
  border-color: #87c8c0;
  transform: translateY(-1px);
}

.preset-card strong,
.preset-card span {
  display: block;
}

.preset-card strong {
  font-size: 13px;
  line-height: 1.25;
}

.preset-card span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.scenario-builder-section {
  padding: 36px 0 78px;
}

.scenario-builder-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.78fr) minmax(620px, 1.72fr);
  gap: 24px;
  align-items: start;
}

.characteristic-deck,
.scenario-canvas,
.scenario-output,
.field-impact-panel,
.source-match-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.characteristic-deck {
  position: sticky;
  top: 22px;
  max-height: calc(100vh - 44px);
  overflow: auto;
}

.deck-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 22px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.deck-heading > p:last-child {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.card-group,
.modifier-group {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modifier-group {
  border-bottom: 0;
}

.card-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.card-group-heading h3 {
  margin: 0;
  font-size: 14px;
}

.card-group-heading span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.characteristic-grid-modifiers {
  grid-template-columns: 1fr;
}

.characteristic-card {
  position: relative;
  min-height: 88px;
  padding: 13px 13px 13px 38px;
  text-align: left;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  cursor: pointer;
}

.characteristic-card:hover:not(:disabled) {
  border-color: var(--blue-500);
}

.characteristic-card.is-selected {
  background: #eef6ff;
  border-color: var(--blue-600);
  box-shadow: inset 0 0 0 1px var(--blue-600);
}

.characteristic-card:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.characteristic-card strong,
.characteristic-card small {
  display: block;
}

.characteristic-card strong {
  font-size: 12px;
  line-height: 1.25;
}

.characteristic-card small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.card-check {
  position: absolute;
  top: 13px;
  left: 12px;
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  color: var(--blue-600);
  background: #eef6ff;
  border: 1px solid #a8cdf3;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 850;
}

.is-selected .card-check {
  color: var(--paper);
  background: var(--blue-600);
  border-color: var(--blue-600);
}

.scenario-workspace {
  display: grid;
  gap: 18px;
}

.scenario-canvas,
.scenario-output,
.field-impact-panel,
.source-match-panel {
  padding: 24px;
}

.button-small {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 12px;
}

.selected-card-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 77px;
  padding: 14px;
  margin-top: 18px;
  background: var(--navy-950);
  border-radius: 10px;
}

.selected-card {
  min-width: 118px;
  padding: 10px 12px;
  color: var(--paper);
  background: var(--navy-800);
  border: 1px solid #28516c;
  border-radius: 8px;
}

.selected-card span,
.selected-card strong {
  display: block;
}

.selected-card span {
  color: #93b0c2;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.055em;
}

.selected-card strong {
  margin-top: 4px;
  font-size: 12px;
}

.scenario-summary {
  margin: 16px 0 0;
  color: #37566b;
  font-size: 15px;
  line-height: 1.55;
}

.scenario-alerts {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.scenario-alert {
  padding: 10px 12px;
  color: #31546a;
  background: var(--wash);
  border-left: 3px solid #91a9b8;
  font-size: 12px;
}

.scenario-alert-ok {
  color: #075c52;
  background: var(--aqua-50);
  border-color: var(--aqua-500);
}

.scenario-alert-warning {
  color: #7d3b30;
  background: var(--warning-bg);
  border-color: var(--warning);
}

.output-qualifier {
  color: var(--muted);
  font-size: 11px;
}

.party-flow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px;
  margin-top: 18px;
  overflow-x: auto;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.flow-node {
  flex: 1 0 110px;
  padding: 11px;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.flow-node strong,
.flow-node span {
  display: block;
}

.flow-node strong {
  font-size: 13px;
}

.flow-node span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.flow-arrow {
  color: var(--blue-600);
  font-size: 20px;
  font-weight: 800;
}

.report-blueprint {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.report-leg {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.report-number {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--paper);
  background: var(--blue-600);
  border-radius: 7px;
  font-weight: 850;
}

.report-leg small {
  color: var(--blue-600);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.report-leg h3,
.report-leg p,
.field-impact-row h3,
.field-impact-row p,
.source-match h3,
.source-match p {
  margin: 0;
}

.report-leg h3 {
  margin-top: 2px;
  font-size: 15px;
}

.report-leg p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.field-impact-list {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}

.field-impact-row {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 16px;
  padding: 14px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.field-impact-row:last-child {
  border-bottom: 0;
}

.field-impact-row code {
  align-self: start;
  color: var(--blue-600);
  font-weight: 850;
}

.field-impact-row h3 {
  font-size: 13px;
}

.field-impact-row p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.source-match-panel .workspace-heading-row a {
  color: var(--blue-600);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.source-match-list {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.source-match {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.source-match > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.055em;
}

.source-match.is-closest {
  background: var(--aqua-50);
  border-color: #9dd9d2;
}

.source-match.is-closest > span {
  color: var(--success);
}

.source-match h3 {
  font-size: 13px;
}

.source-match p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.source-match a {
  color: var(--blue-600);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}

.scenario-disclaimer {
  padding-top: 16px;
  margin: 18px 0 0;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 1180px) {
  .preset-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: 284px;
  }

  .scenario-builder-layout {
    grid-template-columns: minmax(300px, 0.8fr) minmax(500px, 1.2fr);
  }

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

@media (max-width: 860px) {
  .scenario-hero-row,
  .preset-heading-row,
  .workspace-heading-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .scenario-version {
    flex-basis: auto;
    width: 100%;
  }

  .preset-list,
  .scenario-builder-layout {
    grid-template-columns: 1fr;
  }

  .characteristic-deck {
    position: static;
    max-height: none;
  }

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

  .source-match {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .preset-list,
  .characteristic-grid {
    grid-template-columns: 1fr;
  }

  .preset-list {
    min-height: 774px;
  }

  .scenario-canvas,
  .scenario-output,
  .field-impact-panel,
  .source-match-panel {
    padding: 17px;
  }

  .field-impact-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }
}

/* APA reporting responsibility */
.apa-hero {
  color: var(--paper);
  background: var(--navy-950);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.apa-hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  padding: 32px 0 36px;
}

.apa-hero h1 {
  margin: 5px 0 10px;
  font-size: clamp(34px, 4vw, 50px);
  line-height: 1.04;
  letter-spacing: -0.046em;
}

.apa-hero p:not(.eyebrow) {
  max-width: 790px;
  margin: 0;
  color: #bfd0db;
  font-size: 17px;
}

.apa-regime-note {
  flex: 0 0 284px;
  padding: 16px 18px;
  color: var(--ink);
  background: var(--aqua-100);
  border-radius: 10px;
}

.apa-regime-note strong,
.apa-regime-note span,
.apa-regime-note small {
  display: block;
}

.apa-regime-note strong {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.055em;
}

.apa-regime-note span {
  margin-top: 3px;
  font-size: 16px;
  font-weight: 780;
}

.apa-regime-note small {
  margin-top: 6px;
  color: #456779;
  font-size: 12px;
}

.apa-builder-section {
  padding: 30px 0 76px;
}

.apa-layout {
  display: grid;
  grid-template-columns: minmax(520px, 0.94fr) minmax(500px, 1.06fr);
  gap: 24px;
  align-items: start;
}

.apa-questionnaire,
.apa-result-panel,
.apa-reference-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.apa-form-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 24px;
  border-bottom: 1px solid var(--line);
}

.apa-form-heading h2 {
  margin: 3px 0 0;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.apa-question {
  min-width: 0;
  padding: 22px 24px 24px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.apa-question:last-child {
  border-bottom: 0;
}

.apa-question legend {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 790;
}

.apa-question legend > span {
  display: inline-grid;
  width: 27px;
  height: 27px;
  place-items: center;
  color: var(--paper);
  background: var(--navy-800);
  border-radius: 7px;
  font-size: 12px;
}

.apa-question > p {
  margin: 7px 0 14px 37px;
  color: var(--muted);
  font-size: 13px;
}

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

.apa-choice-wide {
  grid-column: 1 / -1;
}

.apa-choice {
  position: relative;
  display: block;
  min-height: 76px;
  cursor: pointer;
}

.apa-choice input,
.apa-segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.apa-choice > span {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.apa-choice:hover > span {
  border-color: #7eb1d4;
}

.apa-choice input:focus-visible + span,
.apa-segmented input:focus-visible + span {
  outline: 3px solid #49d6c8;
  outline-offset: 2px;
}

.apa-choice input:checked + span {
  background: #eef6ff;
  border-color: var(--blue-600);
  box-shadow: inset 0 0 0 1px var(--blue-600);
}

.apa-choice input:checked + span::after {
  position: absolute;
  top: 10px;
  right: 11px;
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  color: var(--paper);
  background: var(--blue-600);
  border-radius: 50%;
  content: "✓";
  font-size: 11px;
  font-weight: 850;
}

.apa-choice strong,
.apa-choice small {
  display: block;
}

.apa-choice strong {
  padding-right: 20px;
  font-size: 14px;
  line-height: 1.3;
}

.apa-choice small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.apa-party-inputs > div {
  padding: 14px;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.apa-party-inputs h3 {
  margin: 0 0 9px;
  font-size: 14px;
}

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

.apa-segmented label {
  position: relative;
  cursor: pointer;
}

.apa-segmented span {
  display: grid;
  min-height: 38px;
  place-items: center;
  padding: 7px;
  color: #466274;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 720;
}

.apa-segmented input:checked + span {
  color: var(--paper);
  background: var(--blue-600);
  border-color: var(--blue-600);
}

.apa-help {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.apa-help summary {
  color: var(--blue-600);
  cursor: pointer;
  font-weight: 750;
}

.apa-help p {
  margin: 8px 0 0;
}

.apa-register-link {
  display: inline-block;
  margin-top: 13px;
  color: var(--blue-600);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.apa-result-column {
  position: sticky;
  top: 22px;
  display: grid;
  gap: 18px;
}

.apa-result-panel,
.apa-reference-card {
  padding: 24px;
}

.apa-result-panel {
  overflow: hidden;
  border-top: 5px solid #91a9b8;
  box-shadow: 0 16px 42px rgba(5, 25, 41, 0.09);
}

.apa-result-panel[data-status="determined"] {
  border-top-color: var(--blue-600);
}

.apa-result-panel[data-status="excluded"] {
  border-top-color: var(--aqua-500);
}

.apa-result-panel[data-status="no-obligation"] {
  border-top-color: #6f8797;
}

.apa-result-panel[data-status="check"] {
  border-top-color: #d38a30;
}

.apa-result-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.apa-state {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 820;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

.apa-state-pending {
  color: #536d7d;
  background: #edf2f5;
}

.apa-state-determined {
  color: #075c52;
  background: var(--aqua-100);
}

.apa-state-excluded {
  color: #075c52;
  background: var(--aqua-100);
}

.apa-state-no-obligation {
  color: #3e5b6d;
  background: #edf2f5;
}

.apa-state-check {
  color: #7a4213;
  background: #fff2dd;
}

.apa-result-panel > h2 {
  max-width: 650px;
  margin: 12px 0 8px;
  font-size: clamp(27px, 3vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.apa-result-summary {
  margin: 0;
  color: #456779;
  font-size: 15px;
}

.apa-party-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 126px minmax(0, 1fr);
  gap: 9px;
  align-items: stretch;
  margin-top: 21px;
}

.apa-party-node,
.apa-trade-node {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 92px;
  padding: 12px;
  text-align: center;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.apa-party-node.is-publisher {
  background: #eef6ff;
  border-color: var(--blue-600);
  box-shadow: inset 0 0 0 1px var(--blue-600);
}

.apa-party-node strong {
  font-size: 14px;
}

.apa-party-node span,
.apa-trade-node span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.apa-party-node em {
  align-self: center;
  padding: 3px 6px;
  margin-top: 7px;
  color: var(--paper);
  background: var(--blue-600);
  border-radius: 4px;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.apa-trade-node {
  color: var(--paper);
  background: var(--navy-900);
  border-color: var(--navy-900);
}

.apa-trade-node span {
  color: #bdd0dc;
}

.apa-trade-node b {
  margin-top: 5px;
  color: var(--aqua-500);
  font-size: 20px;
}

.apa-result-block {
  padding-top: 18px;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.apa-result-block h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.apa-rule-trail {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
  counter-reset: apa-rule;
}

.apa-rule-trail li {
  position: relative;
  min-height: 27px;
  padding: 3px 0 3px 37px;
  color: #3e5c6f;
  font-size: 13px;
  counter-increment: apa-rule;
}

.apa-rule-trail li::before {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: var(--blue-600);
  background: #eef6ff;
  border-radius: 7px;
  content: counter(apa-rule);
  font-size: 11px;
  font-weight: 820;
}

.apa-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.apa-detail-grid > div {
  padding: 11px;
  background: var(--wash);
  border-radius: 8px;
}

.apa-detail-grid dt {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.apa-detail-grid dd {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.35;
}

.apa-check-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.apa-check {
  padding: 10px 12px;
  color: #375b6d;
  background: var(--wash);
  border-left: 3px solid #91a9b8;
  font-size: 12px;
  line-height: 1.45;
}

.apa-check-warning {
  color: #79422f;
  background: var(--warning-bg);
  border-left-color: var(--warning);
}

.apa-check-info {
  color: #305f66;
  background: var(--aqua-50);
  border-left-color: var(--aqua-500);
}

.apa-result-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.apa-result-actions span {
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
}

.apa-reference-card h2 {
  margin: 3px 0 14px;
  font-size: 21px;
  letter-spacing: -0.025em;
}

.apa-reference-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.apa-reference-card th,
.apa-reference-card td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.apa-reference-card th {
  color: var(--muted);
  background: var(--wash);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.apa-reference-card > p:not(.eyebrow) {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.apa-source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 13px;
}

.apa-source-links a {
  color: var(--blue-600);
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
}

@media (max-width: 1180px) {
  .apa-layout {
    grid-template-columns: minmax(470px, 0.95fr) minmax(430px, 1.05fr);
  }

  .apa-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .apa-hero-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .apa-regime-note {
    flex-basis: auto;
    width: 100%;
  }

  .apa-layout {
    grid-template-columns: 1fr;
  }

  .apa-result-column {
    position: static;
  }
}

@media (max-width: 620px) {
  .apa-hero-row {
    gap: 22px;
    padding: 27px 0;
  }

  .apa-hero h1 {
    font-size: 34px;
  }

  .apa-form-heading,
  .apa-question,
  .apa-result-panel,
  .apa-reference-card {
    padding: 17px;
  }

  .apa-choice-grid,
  .apa-party-inputs,
  .apa-party-flow {
    grid-template-columns: 1fr;
  }

  .apa-choice-wide {
    grid-column: auto;
  }

  .apa-question > p {
    margin-left: 0;
  }

  .apa-trade-node {
    min-height: 68px;
  }
}

.matrix-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.matrix-heading-row h3 {
  margin: 3px 0 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.matrix-heading-row > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.matrix-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 10px 13px;
  color: #315568;
  background: var(--aqua-50);
  border: 1px solid #c8e2df;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  font-size: 11px;
  font-weight: 750;
}

.report-matrix-scroll {
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-radius: 0 0 8px 8px;
}

.report-matrix {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
  font-size: 11px;
}

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

.report-matrix tr:last-child th,
.report-matrix tr:last-child td {
  border-bottom: 0;
}

.report-matrix th:last-child,
.report-matrix td:last-child {
  border-right: 0;
}

.report-matrix thead th {
  color: #d9e8f1;
  background: var(--navy-900);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.report-matrix tbody th {
  width: 180px;
  color: var(--ink);
  background: var(--wash);
}

.report-matrix tbody th strong,
.report-matrix tbody th small {
  display: block;
}

.report-matrix tbody th small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  line-height: 1.35;
}

.report-matrix code {
  padding: 2px 5px;
  font-size: 10px;
  white-space: nowrap;
  background: #edf2f5;
  border-radius: 4px;
}

.matrix-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.matrix-empty {
  margin-top: 14px;
  padding: 16px 18px;
  color: #654815;
  background: #fff8e7;
  border: 1px solid #ead39d;
  border-radius: 8px;
}

.matrix-empty strong,
.matrix-empty p {
  display: block;
  margin: 0;
}

.matrix-empty p {
  margin-top: 5px;
  font-size: 14px;
  line-height: 1.5;
}

/* Review 2026-09-05: compact desktop workbench with contained results. */
.scenario-hero { padding: 22px 0; }
.scenario-hero h1 { font-size: clamp(24px, 2.5vw, 34px); line-height: 1.15; }
.scenario-hero p { margin-bottom: 0; }
.scenario-preset-strip { padding: 12px 0; }
.scenario-presets summary, .selected-facts summary, #modifier-cards summary { cursor: pointer; font-weight: 700; padding: 12px 0; font-size: 14px; }
.scenario-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; font-size: 14px; }
.scenario-toolbar span { margin-left: auto; color: var(--muted); }
#scenario-action-status:empty { display: none; }
.scenario-builder-section { padding-top: 18px; }
.scenario-builder-layout { grid-template-columns: minmax(300px, .78fr) minmax(0, 1.72fr); }
.scenario-builder-layout > *, .scenario-workspace > *, #report-matrix, .workspace-heading-row > *, .source-match > * { min-width: 0; max-width: 100%; }
.scenario-workspace { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.scenario-output { order: -1; }
.workspace-heading-row, .matrix-heading-row, .matrix-meta { flex-wrap: wrap; gap: 12px; }
.report-matrix-scroll { max-width: 100%; overflow-x: auto; }
.party-flow { flex-wrap: wrap; overflow: visible; }
.flow-node { min-width: 0; flex: 1 1 120px; overflow-wrap: anywhere; }
.selected-card-tray { flex-wrap: wrap; }
.selected-card { min-width: 0; }
.source-match { grid-template-columns: minmax(0, 1fr); }
.source-match a, .scenario-summary { overflow-wrap: anywhere; }
#modifier-cards { display: block; }
#modifier-cards details { border-top: 1px solid var(--line); }
.article4-checklist { padding: 18px; background: var(--wash); }
.transmission-check { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0; font-size: 14px; }
.transmission-check input { flex: 0 0 auto; margin-top: 4px; }
.characteristic-card small, .scenario-alert, .output-qualifier, .matrix-note, .preset-card strong { font-size: 14px; }
.preset-card span { font-size: 12px; }
.scenario-alerts { margin-bottom: 16px; }
#issue-form { display: grid; gap: 12px; margin-bottom: 24px; }
#issue-form input, #issue-form textarea, #issue-output { width: 100%; font: inherit; padding: 12px; border: 1px solid var(--line); border-radius: 6px; }
#scenario-action-status input { width: 100%; }
button:focus-visible, summary:focus-visible, input:focus-visible { outline: 3px solid #086ad8; outline-offset: 3px; }
@media (max-width: 850px) { .scenario-builder-layout { grid-template-columns: minmax(0, 1fr); } .characteristic-deck { position: static; max-height: none; } }

@media (max-width: 720px) {
  .matrix-heading-row,
  .matrix-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}
