:root {
  --background: #f7f6f2;
  --surface: #fffefa;
  --surface-soft: #f0f1ee;
  --ink: #252b31;
  --strong: #171c21;
  --muted: #687078;
  --line: #d7d9d4;
  --accent: #315f7d;
  --accent-soft: #eaf1f5;
  --warning: #7b5819;
  --warning-soft: #fff8e8;
  --error: #8a342d;
  --error-soft: #fff2f0;
  --focus: #0e6fa8;
  --reading: 920px;
  --wide: 1180px;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --editorial: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
}

body {
  margin: 0 auto;
  max-width: 1380px;
  padding: 0 28px;
}

body.presentation-mode {
  background: var(--surface);
  max-width: none;
  padding: 0;
}

body.presentation-mode .masthead,
body.presentation-mode .context-strip,
body.presentation-mode .site-footer {
  display: none;
}

a,
button,
input,
textarea,
select {
  font: inherit;
}

a,
button {
  touch-action: manipulation;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  background: var(--strong);
  color: #fff;
  left: 16px;
  padding: 8px 12px;
  position: fixed;
  top: -60px;
  z-index: 50;
}

.skip-link:focus {
  top: 12px;
}

.masthead {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 32px;
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 74px;
}

.brand {
  align-items: center;
  color: var(--strong);
  display: inline-flex;
  font-family: var(--editorial);
  font-size: 21px;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  border: 1px solid var(--strong);
  border-radius: 50%;
  display: inline-flex;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.global-nav {
  align-items: stretch;
  display: flex;
  gap: 30px;
  justify-content: flex-end;
  overflow-x: auto;
}

.global-nav a,
.global-nav .deferred {
  align-items: center;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  display: inline-flex;
  font-size: 14px;
  font-weight: 650;
  min-height: 74px;
  padding-top: 3px;
  text-decoration: none;
  white-space: nowrap;
}

.global-nav a:hover {
  color: var(--strong);
}

.global-nav a[aria-current="page"] {
  border-bottom-color: var(--strong);
  color: var(--strong);
}

.global-nav .deferred {
  cursor: not-allowed;
  opacity: .56;
}

.context-strip {
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-size: 12px;
  gap: 12px;
  justify-content: space-between;
  letter-spacing: .025em;
  min-height: 38px;
}

.context-strip strong {
  color: var(--strong);
}

#auth-controls {
  align-items: center;
  display: inline-flex;
  gap: 10px;
  margin-left: 12px;
}

.authenticated-identity {
  color: var(--strong);
  font-weight: 650;
}

.text-button {
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.auth-choice-list {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

#application {
  margin: 0 auto;
  max-width: var(--wide);
  min-height: calc(100vh - 180px);
  padding: clamp(38px, 6vw, 72px) 0 64px;
}

.presentation-mode #application {
  max-width: none;
  min-height: 100vh;
  padding: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  color: var(--strong);
  font-family: var(--editorial);
  font-weight: 500;
  letter-spacing: -.018em;
}

h1 {
  font-size: clamp(2.1rem, 4.2vw, 3.35rem);
  line-height: 1.05;
  margin-bottom: 16px;
}

h2 {
  font-size: clamp(1.35rem, 2.3vw, 1.85rem);
  line-height: 1.2;
}

h3 {
  color: var(--strong);
  font-size: 1rem;
}

.eyebrow,
.status-label,
.type-label {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.lede {
  color: var(--muted);
  font-size: 1.06rem;
  max-width: 720px;
}

.page-heading {
  margin-bottom: 42px;
  max-width: 800px;
}

.heading-actions,
.button-row,
.reader-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.heading-actions {
  justify-content: space-between;
}

.primary-button,
.secondary-button,
.text-button {
  border-radius: 4px;
  cursor: pointer;
  font-weight: 650;
  min-height: 40px;
  padding: 8px 14px;
}

.primary-button {
  background: var(--strong);
  border: 1px solid var(--strong);
  color: #fff;
}

.primary-button:hover:not(:disabled) {
  background: #303940;
}

.secondary-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--strong);
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--strong);
}

.text-button {
  background: transparent;
  border: 0;
  color: var(--accent);
  padding-inline: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.activity-list,
.object-list,
.report-list {
  border-bottom: 1px solid var(--line);
}

.activity-row,
.object-row {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 22px 4px;
}

.activity-row:hover,
.object-row:hover {
  background: rgb(49 95 125 / 3.5%);
}

.activity-copy p,
.object-copy p,
.meta,
.quiet {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 0;
}

.object-copy h2,
.object-copy h3,
.activity-copy h2 {
  margin-bottom: 5px;
}

.section-heading {
  border-bottom: 1px solid var(--line);
  margin: 48px 0 0;
  padding-bottom: 12px;
}

.section-heading:first-child {
  margin-top: 0;
}

.empty-state,
.loading-state,
.error-state,
.status-panel {
  border-left: 3px solid var(--accent);
  margin: 24px 0;
  max-width: 760px;
  padding: 18px 20px;
}

.loading-state {
  background: var(--surface-soft);
}

.error-state {
  background: var(--error-soft);
  border-color: var(--error);
}

.warning-state {
  background: var(--warning-soft);
  border-color: var(--warning);
}

.empty-state p:last-child,
.loading-state p:last-child,
.error-state p:last-child,
.status-panel p:last-child {
  margin-bottom: 0;
}

.library-tabs {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  margin-bottom: 28px;
  overflow-x: auto;
}

.library-tabs a {
  border-bottom: 3px solid transparent;
  color: var(--muted);
  padding: 10px 0;
  text-decoration: none;
  white-space: nowrap;
}

.library-tabs a[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--strong);
  font-weight: 700;
}

.workspace-layout {
  display: grid;
  gap: clamp(28px, 5vw, 58px);
  grid-template-columns: minmax(0, 1.65fr) minmax(250px, .75fr);
}

.workspace-main,
.choices-panel {
  min-width: 0;
}

.choices-panel {
  align-self: start;
  background: var(--surface-soft);
  padding: 22px;
  position: sticky;
  top: 24px;
}

.summary-list {
  display: grid;
  gap: 14px;
  margin: 0;
}

.summary-list div {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.summary-list dt {
  color: var(--muted);
  font-size: 12px;
}

.summary-list dd {
  margin: 3px 0 0;
}

.field-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field,
.choice-list {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

label,
legend {
  color: var(--strong);
  font-size: .88rem;
  font-weight: 700;
}

input,
textarea,
select {
  background: var(--surface);
  border: 1px solid #bfc3c0;
  border-radius: 3px;
  color: var(--ink);
  min-height: 42px;
  padding: 9px 10px;
  width: 100%;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input[readonly] {
  background: var(--surface-soft);
  color: var(--muted);
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.section-choice {
  align-items: start;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 13px 2px;
}

.section-choice input {
  margin-top: 3px;
  min-height: auto;
  width: auto;
}

.validation-list {
  margin-bottom: 0;
}

.preview-banner {
  background: var(--accent-soft);
  border: 1px solid #b8ccd8;
  color: var(--strong);
  font-weight: 750;
  margin-bottom: 30px;
  padding: 12px 16px;
}

.reader-header {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 38px;
  padding-bottom: 22px;
}

.reader-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: .83rem;
  gap: 8px 18px;
}

.reader-layout {
  display: grid;
  gap: clamp(26px, 5vw, 56px);
  grid-template-columns: 220px minmax(0, 1fr);
}

.section-index {
  align-self: start;
  border-top: 1px solid var(--line);
  list-style: none;
  margin: 0;
  padding: 0;
  position: sticky;
  top: 24px;
}

.section-index a,
.section-index button {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  display: block;
  font-size: .84rem;
  padding: 11px 2px;
  text-decoration: none;
  text-align: left;
  width: 100%;
}

.reader-document {
  max-width: var(--reading);
  min-width: 0;
}

.commentary {
  border-left: 2px solid var(--line);
  color: var(--ink);
  margin: 24px 0;
  padding-left: 18px;
}

.commentary[data-kind="Heading"] {
  border-left: 0;
  font-family: var(--editorial);
  font-size: 1.35rem;
  padding-left: 0;
}

.report {
  margin: 0 0 58px;
}

.report > header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  padding-bottom: 14px;
}

.report-section {
  margin: 32px 0;
  scroll-margin-top: 24px;
}

.fact-list {
  border-bottom: 1px solid var(--line);
  margin: 0;
}

.fact {
  align-items: baseline;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, auto);
  padding: 12px 2px;
}

.fact dt {
  color: var(--muted);
}

.fact dd {
  color: var(--strong);
  font-weight: 700;
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.notices {
  background: var(--warning-soft);
  color: var(--warning);
  padding: 14px 18px;
}

.reader-navigation {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 18px;
}

.validation-reader .page-heading {
  border-left: 4px solid var(--warning);
  padding-left: 18px;
}

.presentation-shell {
  background: var(--surface);
  min-height: 100vh;
  padding: clamp(24px, 5vw, 68px);
}

.presentation-header {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin: 0 auto 44px;
  max-width: 1080px;
  padding-bottom: 18px;
}

.presentation-shell .reader-document {
  margin: 0 auto;
  max-width: 980px;
}

.presentation-shell .reader-navigation {
  margin-inline: auto;
  max-width: 1080px;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  padding: 14px 0 24px;
}

@media (max-width: 820px) {
  body {
    padding-inline: 18px;
  }

  .masthead {
    align-items: start;
    gap: 8px;
    grid-template-columns: 1fr;
    padding-top: 16px;
  }

  .global-nav {
    justify-content: flex-start;
  }

  .global-nav a,
  .global-nav .deferred {
    min-height: 48px;
  }

  .workspace-layout,
  .reader-layout {
    grid-template-columns: 1fr;
    min-width: 0;
    width: 100%;
  }

  .choices-panel,
  .section-index {
    position: static;
  }

  .section-index {
    display: flex;
    min-width: 100%;
    overflow-x: auto;
    width: max-content;
  }

  .reader-layout > nav {
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
  }

  .section-index a,
  .section-index button {
    border-right: 1px solid var(--line);
    min-width: 180px;
    padding-inline: 10px;
  }
}

@media (max-width: 560px) {
  .context-strip,
  .reader-header,
  .activity-row,
  .object-row,
  .reader-navigation,
  .presentation-header,
  .site-footer {
    align-items: start;
    display: flex;
    flex-direction: column;
  }

  .context-strip {
    gap: 2px;
    justify-content: center;
    padding-block: 8px;
  }

  .field-grid,
  .fact {
    grid-template-columns: 1fr;
  }

  .fact dd {
    text-align: left;
  }
}

@media print {
  body,
  body.presentation-mode {
    background: #fff;
    color: #000;
    padding: 0;
  }

  .masthead,
  .context-strip,
  .site-footer,
  .presentation-header button,
  .reader-navigation {
    display: none !important;
  }

  .presentation-shell {
    padding: 0;
  }

  .report,
  .report-section {
    break-inside: avoid;
  }
}
