:root {
  font-family: Aptos, "Segoe UI Variable Text", "Segoe UI", sans-serif;
  color: #182235;
  background: #ebe6da;
  --paper: #f3efe5;
  --surface: #fffdf8;
  --surface-deep: #f7f2e8;
  --ink: #182235;
  --ink-soft: #4b5870;
  --ink-faint: #68748a;
  --rule: #cfc7b8;
  --rule-strong: #a99f8f;
  --blue: #315f86;
  --blue-deep: #23445f;
  --blue-soft: #e4edf4;
  --good: #21634e;
  --good-soft: #e4f0e9;
  --bad: #9d4139;
  --bad-soft: #f5e6e3;
  --warn: #8b6428;
  --warn-soft: #f4ecd9;
}

* { box-sizing: border-box; }

html { background: #ebe6da; }

body {
  margin: 0;
  min-height: 100vh;
  background: #ebe6da;
  color: var(--ink);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

::selection {
  background: #c8ddeb;
  color: #112238;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #8f9aaa #ebe6da;
}

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: #ebe6da; }
*::-webkit-scrollbar-thumb { background: #8f9aaa; border: 2px solid #ebe6da; border-radius: 999px; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled {
  cursor: not-allowed;
  opacity: .48;
  transform: none !important;
}

button, input, select, textarea, summary {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid #79a9ca;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  left: 18px;
  top: 12px;
  transform: translateY(-160%);
  background: var(--ink);
  color: #fffdf8;
  padding: 9px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 750;
}

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

.shell {
  width: min(1380px, calc(100% - 44px));
  margin: 0 auto;
  padding: 44px 0 32px;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 44px;
  align-items: end;
  padding: 18px 4px 30px;
}

.brand-block { max-width: 850px; }

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

h1, h2 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  text-wrap: balance;
}

h1 {
  margin-bottom: 14px;
  color: var(--ink);
  font-size: clamp(3.15rem, 7vw, 6rem);
  font-weight: 500;
  line-height: .88;
  letter-spacing: -.038em;
}

h1 span {
  display: block;
  color: var(--blue-deep);
  font-size: .34em;
  font-family: Aptos, "Segoe UI Variable Text", "Segoe UI", sans-serif;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1.1;
  margin-bottom: 7px;
}

.lede {
  max-width: 69ch;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: clamp(1rem, 1.7vw, 1.2rem);
  line-height: 1.62;
}

.policy-line {
  display: grid;
  gap: 8px;
  min-width: 180px;
  padding-bottom: 4px;
  color: var(--ink-soft);
  font-size: .77rem;
  font-weight: 800;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.policy-line span {
  padding-left: 12px;
  border-left: 1px solid var(--rule-strong);
}

.environment-strip {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  margin-bottom: 18px;
}

.environment-heading {
  padding: 18px 22px 18px 4px;
  border-right: 1px solid var(--rule);
}

.environment-heading h2 {
  margin-bottom: 2px;
  font-size: 1.08rem;
  font-family: Aptos, "Segoe UI Variable Text", "Segoe UI", sans-serif;
  font-weight: 800;
  letter-spacing: -.01em;
}

.environment-heading p,
.catalog-copy p,
.pane-heading p,
.form-section-heading p,
.evidence-heading p,
.review-heading p,
.governance-note p {
  margin-bottom: 0;
  color: var(--ink-soft);
}

.environment-heading p { font-size: .8rem; }

.status-ledger {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.status-item {
  position: relative;
  min-width: 0;
  padding: 16px 18px 15px 36px;
  display: grid;
  align-content: center;
  gap: 2px;
}

.status-item + .status-item { border-left: 1px solid var(--rule); }

.status-item::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 25px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rule-strong);
}

.status-item[data-state="neutral"]::before { background: var(--blue); }
.status-item[data-state="ok"]::before { background: var(--good); }
.status-item[data-state="warn"]::before { background: var(--warn); }
.status-item[data-state="error"]::before { background: var(--bad); }
.status-item[data-state="checking"]::before { animation: status-pulse 1.35s ease-in-out infinite; }

@keyframes status-pulse {
  0%, 100% { opacity: .38; transform: scale(.82); }
  50% { opacity: 1; transform: scale(1.16); }
}

.status-label {
  color: var(--ink-faint);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.status-item strong {
  overflow: hidden;
  color: var(--ink);
  font-size: .93rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-item code,
.status-detail {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: .72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.status-item code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

.catalog-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 480px);
  gap: 30px;
  align-items: center;
  margin-bottom: 18px;
  padding: 17px 20px;
  background: var(--surface-deep);
  border: 1px solid var(--rule);
  border-radius: 10px;
}

.catalog-copy h2 {
  margin-bottom: 2px;
  font-family: Aptos, "Segoe UI Variable Text", "Segoe UI", sans-serif;
  font-size: 1rem;
  font-weight: 850;
}

.catalog-copy p { font-size: .82rem; }

.access-disclosure { min-width: 0; }

.access-disclosure summary {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  color: var(--blue-deep);
  font-size: .82rem;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

.access-disclosure summary::-webkit-details-marker { display: none; }

.access-disclosure summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  color: var(--ink-soft);
  font-size: 1rem;
  font-weight: 500;
}

.access-disclosure[open] summary::after { content: "−"; }

.access-body {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

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

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, .78fr) minmax(0, 1.22fr);
  min-height: 720px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 14px;
  box-shadow: 0 20px 58px rgba(38, 43, 54, .12), 0 3px 9px rgba(38, 43, 54, .08);
  overflow: hidden;
}

.controls,
.results {
  min-width: 0;
  padding: 28px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid var(--rule);
  background: #fffdf8;
}

.results { background: #fbf8f1; }

.pane-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.pane-heading h2 {
  margin-bottom: 5px;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  font-weight: 500;
  letter-spacing: -.025em;
}

.pane-heading p { max-width: 58ch; font-size: .88rem; line-height: 1.55; }

.machine-label,
.human-label {
  flex: 0 0 auto;
  max-width: 190px;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 6px 8px;
  color: var(--ink-soft);
  background: #f6f1e7;
  font: 700 .68rem/1.2 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-section {
  display: grid;
  gap: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}

.form-section h3,
.evidence-heading h3,
.review-heading h3 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: .84rem;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.form-section-heading { display: grid; gap: 3px; }
.form-section-heading p,
.evidence-heading p,
.review-heading p { font-size: .79rem; line-height: 1.5; }

.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--rule-strong);
  border-radius: 7px;
  background: #fffefb;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input::placeholder,
textarea::placeholder { color: #6b7689; opacity: 1; }

input:hover,
select:hover,
textarea:hover { border-color: #8f9caf; }

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(49, 95, 134, .13);
  background: #ffffff;
}

select:disabled { color: var(--ink-faint); background: #f1ede5; }

textarea {
  resize: vertical;
  min-height: 92px;
  caret-color: var(--blue-deep);
  line-height: 1.5;
}

input[type="file"] { padding: 8px; }
input[type="file"]::file-selector-button {
  margin-right: 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  background: var(--surface-deep);
  color: var(--ink);
  padding: 7px 9px;
  font-weight: 750;
  cursor: pointer;
}

.segmented {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--rule);
}

.segment {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  padding: 7px 0 10px;
  font-weight: 800;
}

.segment::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -1px;
  height: 2px;
  background: var(--blue);
  transition: right 180ms cubic-bezier(.16, 1, .3, 1);
}

.segment:hover { color: var(--ink); }
.segment.active { color: var(--blue-deep); }
.segment.active::after { right: 0; }

.mode-block { display: grid; gap: 11px; }
.hidden { display: none !important; }

.confirm-row {
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 11px;
  padding: 13px 14px;
  border: 1px solid #d7c594;
  border-radius: 8px;
  background: var(--warn-soft);
  color: #49391f;
  font-weight: 500;
  line-height: 1.43;
}

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

.confirm-row span { display: grid; gap: 2px; }
.confirm-row strong { font-size: .78rem; letter-spacing: .02em; }

.run-bar {
  margin-top: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}

.run-label {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 850;
}

.primary,
.secondary,
.approve,
.reject {
  border-radius: 7px;
  padding: 10px 13px;
  font-weight: 820;
  border: 1px solid transparent;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.primary:hover:not(:disabled),
.secondary:hover:not(:disabled),
.approve:hover:not(:disabled),
.reject:hover:not(:disabled) { transform: translateY(-1px); }

.primary {
  min-width: 176px;
  background: var(--blue-deep);
  color: #fffdf8;
  border-color: var(--blue-deep);
}

.primary:hover:not(:disabled) { background: #173a54; border-color: #173a54; }
.primary:disabled { opacity: .42; }

.secondary {
  background: #fffdf8;
  border-color: var(--rule-strong);
  color: var(--ink);
}

.secondary:hover:not(:disabled) { border-color: var(--blue); color: var(--blue-deep); }

.hint,
.inline-message {
  color: var(--ink-soft);
  font-size: .78rem;
  line-height: 1.5;
  margin: 0;
}

.results-heading {
  padding-bottom: 21px;
  border-bottom: 1px solid var(--rule);
}

.result-badge {
  justify-self: start;
  white-space: nowrap;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: .67rem;
  font-weight: 900;
  letter-spacing: .065em;
  border: 1px solid var(--rule-strong);
  font-variant-numeric: tabular-nums;
}

.result-badge.pass { color: var(--good); border-color: #83ad9a; background: var(--good-soft); }
.result-badge.fail { color: var(--bad); border-color: #c89189; background: var(--bad-soft); }
.result-badge.neutral { color: var(--ink-soft); background: #f1ece3; }

.empty-state {
  min-height: 570px;
  display: grid;
  place-content: center;
  justify-items: start;
  max-width: 520px;
  padding: 40px 10px;
}

.empty-rule {
  width: 72px;
  height: 1px;
  margin-bottom: 22px;
  background: var(--rule-strong);
}

.empty-state strong {
  margin-bottom: 7px;
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  font-size: 1.55rem;
  font-weight: 500;
}

.empty-state p {
  max-width: 50ch;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: .9rem;
  line-height: 1.65;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 22px 0 28px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.meta-grid div {
  min-width: 0;
  padding: 12px 13px 13px;
  display: grid;
  gap: 4px;
}

.meta-grid div + div { border-left: 1px solid var(--rule); }

.meta-grid span {
  color: var(--ink-faint);
  font-size: .67rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.meta-grid strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 700 .78rem/1.35 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
}

.evidence-section { margin-bottom: 22px; }
.evidence-heading { display: grid; gap: 3px; margin-bottom: 11px; }

.checks {
  border-top: 1px solid var(--rule);
}

.check {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px 4px;
  border-bottom: 1px solid var(--rule);
}

.check .icon {
  position: relative;
  display: block;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.check.pass .icon { color: var(--good); }
.check.fail .icon { color: var(--bad); }

.check.pass .icon::before {
  content: "";
  position: absolute;
  width: 7px;
  height: 4px;
  left: 4px;
  top: 4px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.check.fail .icon::before,
.check.fail .icon::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 7px;
  width: 9px;
  height: 1.5px;
  background: currentColor;
}

.check.fail .icon::before { transform: rotate(45deg); }
.check.fail .icon::after { transform: rotate(-45deg); }

.check .label {
  color: var(--ink);
  font-size: .84rem;
  line-height: 1.5;
}

.output-details {
  margin-top: 4px;
  overflow: hidden;
  border: 1px solid #34465b;
  border-radius: 8px;
  background: #182235;
}

.output-details summary {
  padding: 11px 13px;
  cursor: pointer;
  color: #edf2f5;
  background: #213047;
  font-size: .8rem;
  font-weight: 800;
}

.output-details pre {
  margin: 0;
  border-top: 1px solid #34465b;
  padding: 15px;
  max-height: 430px;
  overflow: auto;
  color: #dbe4ec;
  background: #182235;
  font: 12px/1.58 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
  white-space: pre-wrap;
  word-break: break-word;
}

.review-box {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--rule-strong);
  display: grid;
  gap: 13px;
}

.review-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.review-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

.approve {
  background: var(--good-soft);
  color: var(--good);
  border-color: #89b09d;
}

.reject {
  background: var(--bad-soft);
  color: var(--bad);
  border-color: #ca958e;
}

.approve.is-active,
.approve[aria-pressed="true"] {
  background: var(--good);
  border-color: var(--good);
  color: #fffdf8;
}

.reject.is-active,
.reject[aria-pressed="true"] {
  background: var(--bad);
  border-color: var(--bad);
  color: #fffdf8;
}

.review-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.governance-note {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 20px;
  padding: 22px 4px 0;
  color: var(--ink-soft);
  font-size: .78rem;
  line-height: 1.6;
}

.governance-note strong { color: var(--ink); }

code { color: var(--blue-deep); }

.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;
}

@media (max-width: 1060px) {
  .workspace { grid-template-columns: minmax(330px, .9fr) minmax(0, 1.1fr); }
  .field-pair { grid-template-columns: 1fr; }
  .run-bar { grid-template-columns: 1fr; }
  .primary { width: 100%; }
}

@media (max-width: 900px) {
  .shell { width: min(100% - 28px, 1380px); padding-top: 28px; }
  .masthead { grid-template-columns: 1fr; gap: 22px; }
  .policy-line { grid-template-columns: repeat(3, auto); justify-content: start; min-width: 0; }
  .environment-strip { grid-template-columns: 1fr; }
  .environment-heading { border-right: 0; border-bottom: 1px solid var(--rule); padding-left: 0; }
  .catalog-bar { grid-template-columns: 1fr; gap: 12px; }
  .access-disclosure summary { justify-content: flex-start; }
  .workspace { grid-template-columns: 1fr; }
  .controls { border-right: 0; border-bottom: 1px solid var(--rule); }
  .field-pair { grid-template-columns: 1fr 1fr; }
  .empty-state { min-height: 360px; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 20px, 1380px); padding-top: 18px; }
  h1 { font-size: clamp(2.7rem, 16vw, 4.4rem); }
  .policy-line { grid-template-columns: 1fr; gap: 5px; }
  .status-ledger { grid-template-columns: 1fr; }
  .status-item + .status-item { border-left: 0; border-top: 1px solid var(--rule); }
  .access-row { grid-template-columns: 1fr; }
  .controls, .results { padding: 22px 18px; }
  .pane-heading, .review-heading { display: grid; }
  .machine-label, .human-label { max-width: 100%; width: fit-content; }
  .field-pair, .review-actions { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .meta-grid div:nth-child(3) { border-left: 0; border-top: 1px solid var(--rule); }
  .meta-grid div:nth-child(4) { border-top: 1px solid var(--rule); }
  .review-footer { align-items: stretch; flex-direction: column; }
  .governance-note { grid-template-columns: 1fr; gap: 3px; }
}

@media (max-width: 420px) {
  .meta-grid { grid-template-columns: 1fr; }
  .meta-grid div + div { border-left: 0; border-top: 1px solid var(--rule); }
}

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