:root {
  --bg: #f5f2ec;
  --surface: #ffffff;
  --surface-2: #f8faf7;
  --ink: #1d2420;
  --muted: #68726c;
  --line: #d8ded5;
  --line-strong: #bcc7be;
  --green: #2f7d5c;
  --green-soft: #e5f2eb;
  --amber: #b56b22;
  --amber-soft: #fbeddc;
  --red: #b94848;
  --red-soft: #f8e4e1;
  --teal: #2e7885;
  --teal-soft: #e0f1f3;
  --plum: #6d5578;
  --plum-soft: #eee7f1;
  --charcoal: #26302b;
  --shadow: 0 14px 36px rgba(49, 55, 47, 0.08);
}

html,
body {
  margin: 0;
  background: var(--bg);
}

@media (prefers-color-scheme: dark) {
  html,
  body {
    background: #101411;
    color: #edf5ee;
  }
}

#observablehq-main,
#observablehq-center,
.observablehq {
  max-width: none !important;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
}

.es-platform {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(245, 242, 236, 0.95)),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.es-platform[data-theme="dark"] {
  --bg: #101411;
  --surface: #171d19;
  --surface-2: #1d241f;
  --ink: #edf5ee;
  --muted: #a6b3aa;
  --line: #303a34;
  --line-strong: #46544b;
  --green: #76c79e;
  --green-soft: #183728;
  --amber: #e2a25f;
  --amber-soft: #3b2b19;
  --red: #ef8585;
  --red-soft: #3a2223;
  --teal: #7ccbd4;
  --teal-soft: #17363b;
  --plum: #c89ed8;
  --plum-soft: #302438;
  --charcoal: #0c1110;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  color-scheme: dark;
  background:
    linear-gradient(180deg, rgba(20, 26, 21, 0.82), rgba(16, 20, 17, 0.96)),
    var(--bg);
}

.es-platform * {
  box-sizing: border-box;
  letter-spacing: 0;
}

.es-platform h1,
.es-platform h2,
.es-platform h3,
.es-platform strong {
  color: var(--ink);
}

.es-platform p {
  color: inherit;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
}

.auth-panel {
  display: grid;
  gap: 22px;
  width: min(100%, 520px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-copy {
  display: grid;
  gap: 10px;
}

.auth-copy h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.05;
}

.auth-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.auth-error {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 700;
}

.auth-action {
  width: 100%;
}

.auth-actions {
  display: grid;
  gap: 10px;
}

.auth-action:disabled {
  cursor: wait;
  opacity: 0.72;
}

.auth-reset-action {
  justify-self: center;
  min-height: 30px;
  white-space: normal;
}

.auth-reset-action:disabled {
  cursor: wait;
  opacity: 0.72;
}

.platform-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  overflow-x: hidden;
}

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

.empty-workspace h2,
.empty-state-panel h3,
.starter-card h3 {
  margin: 0;
}

.empty-workspace p,
.empty-state-panel p,
.starter-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.starter-card,
.empty-state-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.access-starter {
  margin-bottom: 16px;
}

.invite-list {
  display: grid;
  gap: 8px;
}

.invite-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.invite-list span {
  color: var(--muted);
  font-size: 13px;
}

.platform-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px 14px;
  background: #fbfaf6;
  border-right: 1px solid var(--line);
}

.es-platform[data-theme="dark"] .platform-sidebar {
  background: #141a16;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 12px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--charcoal);
  color: #fffaf1;
  font-weight: 800;
  font-size: 13px;
}

.brand-name {
  font-weight: 800;
  font-size: 16px;
}

.brand-meta,
.mini-label,
.section-kicker,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.screen-nav {
  display: grid;
  gap: 4px;
}

.nav-item,
button,
select,
input,
textarea {
  font: inherit;
}

.nav-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: #eef3ed;
  border-color: var(--line);
}

.es-platform[data-theme="dark"] .nav-item:hover,
.es-platform[data-theme="dark"] .nav-item.active {
  background: #202820;
}

.nav-bullet {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--line-strong);
}

.nav-item.active .nav-bullet {
  background: var(--green);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.sidebar-footer strong {
  color: var(--ink);
}

.platform-main {
  min-width: 0;
  overflow-x: hidden;
}

.workspace-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  min-height: 84px;
  padding: 18px 28px;
  background: rgba(245, 242, 236, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.es-platform[data-theme="dark"] .workspace-topbar {
  background: rgba(16, 20, 17, 0.92);
}

.workspace-topbar h1 {
  margin: 4px 0 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.08;
}

.topbar-cluster {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-metric {
  display: grid;
  min-width: 106px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
}

.es-platform[data-theme="dark"] .topbar-metric {
  background: rgba(23, 29, 25, 0.82);
}

.topbar-metric span {
  color: var(--muted);
  font-size: 12px;
}

.topbar-metric strong {
  font-size: 20px;
}

.screen-frame {
  padding: 26px 28px 36px;
}

.kpi-grid,
.export-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.kpi-card,
.workspace-panel,
.pipeline-step,
.comment-card,
.chunk-card,
.standard-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.kpi-card {
  display: grid;
  gap: 6px;
  min-height: 108px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.kpi-card span,
.kpi-card em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.kpi-card strong {
  font-size: 30px;
  line-height: 1;
}

.pipeline-band {
  display: grid;
  grid-template-columns: repeat(6, minmax(132px, 1fr));
  gap: 10px;
  margin-top: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pipeline-step {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 156px;
  padding: 14px;
}

.step-index {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 800;
}

.pipeline-step h2,
.workspace-panel h2,
.comment-card h3,
.chunk-card h3,
.gap-row h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.pipeline-step p,
.gap-row p,
.comment-card p,
.chunk-card p,
.drop-zone p,
.finding-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.pipeline-step strong {
  align-self: end;
  font-size: 13px;
}

.dashboard-grid,
.two-column-screen,
.architecture-detail-grid,
.evidence-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.workspace-panel {
  padding: 18px;
  box-shadow: var(--shadow);
}

.wide-panel {
  grid-column: 1 / -1;
}

.panel-heading,
.comment-card-header,
.chunk-meta,
.page-header,
.comment-actions,
.export-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading {
  margin-bottom: 14px;
}

.section-kicker {
  margin: 0 0 4px;
}

.primary-action,
.secondary-action,
.link-action,
.citation-button,
.matrix-link {
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.primary-action {
  padding: 8px 14px;
  background: var(--green);
  color: white;
  font-weight: 800;
}

.primary-action strong,
.primary-action span {
  color: currentColor;
}

.secondary-action {
  padding: 8px 12px;
  background: #f7f8f5;
  border-color: var(--line-strong);
  color: var(--ink);
  font-weight: 700;
}

.es-platform[data-theme="dark"] .secondary-action {
  background: #202820;
}

.link-action,
.matrix-link {
  padding: 0;
  background: transparent;
  color: var(--teal);
  font-weight: 800;
}

.primary-action:hover,
.secondary-action:hover,
.link-action:hover,
.citation-button:hover,
.matrix-link:hover {
  filter: brightness(0.97);
}

.score-layout {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.score-ring {
  --score: 0;
  display: grid;
  width: 148px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--score) * 1%), #e4e8e2 0);
}

.es-platform[data-theme="dark"] .score-ring {
  background: conic-gradient(var(--green) calc(var(--score) * 1%), #2b352f 0);
}

.score-ring::before {
  content: "";
  position: absolute;
}

.score-ring span {
  display: grid;
  width: 104px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: white;
  font-size: 34px;
  font-weight: 900;
}

.es-platform[data-theme="dark"] .score-ring span {
  background: var(--surface);
}

.risk-bars,
.query-block,
.artifact-list,
.gap-list,
.chunk-list,
.type-strip {
  display: grid;
  gap: 10px;
}

.risk-row,
.confidence-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar-track,
.score-meter {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e8ede7;
}

.es-platform[data-theme="dark"] .bar-track,
.es-platform[data-theme="dark"] .score-meter {
  background: #2b352f;
}

.bar-fill,
.score-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.bar-fill.high,
.risk-badge.high {
  background: var(--red-soft);
  color: var(--red);
}

.bar-fill.medium,
.risk-badge.medium {
  background: var(--amber-soft);
  color: var(--amber);
}

.bar-fill.low,
.risk-badge.low,
.bar-fill.confidence {
  background: var(--green-soft);
  color: var(--green);
}

.bar-fill.partially-addressed,
.bar-fill.in-review,
.bar-fill.at-risk {
  background: var(--amber);
}

.bar-fill.needs-specialist-review {
  background: var(--plum);
}

.bar-fill.high {
  background: var(--red);
}

.bar-fill.medium {
  background: var(--amber);
}

.bar-fill.low,
.bar-fill.confidence,
.score-meter span {
  background: var(--green);
}

.status-pill,
.risk-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.complete,
.status-pill.compliant,
.status-pill.ai-review-complete,
.status-pill.mapped,
.status-pill.active,
.status-pill.owner {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.partially-addressed,
.status-pill.in-review,
.status-pill.extracting,
.status-pill.queued,
.status-pill.reviewer,
.status-pill.contributor,
.status-pill.invited,
.status-pill.at-risk {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.insufficient-evidence,
.status-pill.not-addressed {
  background: var(--red-soft);
  color: var(--red);
}

.status-pill.needs-specialist-review {
  background: var(--plum-soft);
  color: var(--plum);
}

.status-pill.viewer,
.status-pill.assessment-running {
  background: var(--teal-soft);
  color: var(--teal);
}

.table-scroll,
.matrix-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  position: sticky;
  top: 0;
  background: #f1f5ef;
  color: #435046;
  font-size: 12px;
  text-transform: uppercase;
  z-index: 1;
}

.es-platform[data-theme="dark"] th {
  background: #202820;
  color: #bdcabf;
}

td {
  font-size: 14px;
}

td strong,
td span {
  display: block;
}

td span,
td code {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.gap-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.gap-row:first-child {
  border-top: 0;
}

.requirement-id {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.gap-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.project-card-list,
.project-grid,
.report-grid,
.portfolio-grid,
.action-template-list,
.role-stack,
.assessment-mini-list {
  display: grid;
  gap: 12px;
}

.project-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.project-card.active,
.project-tile.active,
.report-card.active {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 45%, transparent);
}

.project-card span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.project-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-grid,
.report-grid,
.portfolio-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-tile,
.report-card,
.portfolio-card,
.action-template,
.role-card,
.assessment-mini {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.project-tile,
.report-card,
.portfolio-card,
.action-template,
.role-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.project-tile h3,
.report-card h3,
.action-template h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.project-tile p,
.report-card p,
.portfolio-card p,
.role-card p,
.action-template p,
.empty-state {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.project-tile-header,
.report-card-header,
.report-card-footer,
.portfolio-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.project-metrics,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.project-metrics div,
.detail-grid div {
  display: grid;
  gap: 4px;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.project-metrics span,
.detail-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.project-metrics strong {
  font-size: 24px;
}

.access-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.35fr) minmax(0, 0.65fr);
  gap: 16px;
}

.role-card strong {
  font-size: 16px;
}

.report-card-footer span {
  color: var(--muted);
  font-size: 13px;
}

.report-detail {
  display: grid;
  gap: 14px;
}

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

.detail-grid div:last-child {
  grid-column: 1 / -1;
}

.detail-grid strong {
  overflow-wrap: anywhere;
}

.assessment-mini {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.assessment-mini span,
.assessment-mini em {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.portfolio-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.portfolio-card li {
  margin: 5px 0;
}

.score-ring.compact {
  width: 108px;
}

.score-ring.compact span {
  width: 76px;
  font-size: 26px;
}

.drop-zone {
  display: grid;
  justify-items: center;
  gap: 12px;
  min-height: 318px;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  text-align: center;
}

.drop-zone h3 {
  margin: 0;
  font-size: 22px;
}

.drop-visual {
  display: grid;
  width: min(260px, 100%);
  height: 132px;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(47, 125, 92, 0.12), rgba(181, 107, 34, 0.12)),
    #fff;
  border: 1px solid var(--line);
}

.es-platform[data-theme="dark"] .drop-visual {
  background:
    linear-gradient(135deg, rgba(118, 199, 158, 0.14), rgba(226, 162, 95, 0.16)),
    #141a16;
}

.doc-stack {
  position: relative;
  width: 112px;
  height: 82px;
}

.doc-stack span {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background:
    repeating-linear-gradient(180deg, #fff 0 13px, #edf2ec 13px 15px),
    #fff;
}

.es-platform[data-theme="dark"] .doc-stack span {
  background:
    repeating-linear-gradient(180deg, #202820 0 13px, #303a34 13px 15px),
    #202820;
}

.doc-stack span:nth-child(1) {
  transform: translate(-18px, 10px) rotate(-7deg);
}

.doc-stack span:nth-child(2) {
  transform: translate(16px, 4px) rotate(6deg);
}

.doc-stack span:nth-child(3) {
  transform: translate(0, 0);
}

.type-strip {
  grid-template-columns: repeat(6, 1fr);
  margin-top: 12px;
}

.type-strip span,
.tag-row span,
.query-chips span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef3ed;
  color: #425148;
  font-size: 12px;
  font-weight: 800;
}

.es-platform[data-theme="dark"] .type-strip span,
.es-platform[data-theme="dark"] .tag-row span,
.es-platform[data-theme="dark"] .query-chips span {
  background: #202820;
  color: #bdcabf;
}

.artifact-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

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

.artifact-row code {
  overflow-wrap: anywhere;
  color: var(--teal);
}

.viewer-screen {
  display: grid;
  gap: 16px;
}

.viewer-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

select,
input,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 8px 10px;
  text-transform: none;
}

.es-platform[data-theme="dark"] select,
.es-platform[data-theme="dark"] input,
.es-platform[data-theme="dark"] textarea {
  background: #101411;
}

textarea {
  min-width: 240px;
  min-height: 104px;
  resize: vertical;
  line-height: 1.45;
}

.query-chips,
.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.viewer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 16px;
}

.document-canvas {
  display: grid;
  min-height: 690px;
  place-items: start center;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.025) 1px, transparent 1px),
    linear-gradient(0deg, rgba(0, 0, 0, 0.025) 1px, transparent 1px),
    #ecefe8;
  background-size: 24px 24px;
}

.es-platform[data-theme="dark"] .document-canvas {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    #121713;
}

.document-page {
  width: min(100%, 720px);
  min-height: 640px;
  padding: 34px;
  border: 1px solid #c7d1c6;
  border-radius: 4px;
  background: white;
  box-shadow: 0 24px 50px rgba(55, 61, 52, 0.18);
}

.es-platform[data-theme="dark"] .document-page {
  border-color: #46544b;
  background: #f6f3eb;
  color: #202820;
}

.es-platform[data-theme="dark"] .document-page h2,
.es-platform[data-theme="dark"] .document-page strong {
  color: #202820;
}

.page-header {
  padding-bottom: 12px;
  border-bottom: 2px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.document-page h2 {
  margin: 28px 0 14px;
  font-size: 24px;
}

.document-page p {
  color: #313a34;
  font-size: 18px;
  line-height: 1.65;
}

.es-platform[data-theme="dark"] .document-page p {
  color: #313a34;
}

mark {
  padding: 1px 3px;
  border-radius: 4px;
  background: #ffe6a7;
  color: #332714;
}

.es-platform[data-theme="dark"] mark {
  background: #ffe18f;
  color: #332714;
}

.page-table {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  margin-top: 30px;
  border: 1px solid var(--line);
}

.page-table div {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.page-table div:nth-child(odd) {
  background: #f3f6f0;
  color: var(--muted);
  font-weight: 800;
}

.es-platform[data-theme="dark"] .page-table div:nth-child(odd) {
  background: #ebe7dc;
}

.chunk-list {
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.chunk-card {
  padding: 14px;
}

.chunk-meta {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.chunk-card h3 {
  margin-bottom: 8px;
}

.matrix-controls {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 16px;
}

.filter-cluster {
  display: grid;
  grid-template-columns: 190px 140px minmax(220px, 320px);
  gap: 10px;
  align-items: end;
}

.review-matrix {
  min-width: 1180px;
}

.review-matrix th:nth-child(1) {
  width: 260px;
}

.review-matrix th:nth-child(2) {
  width: 180px;
}

.review-matrix th:nth-child(5) {
  width: 190px;
}

.review-matrix th:nth-child(6) {
  width: 280px;
}

.review-matrix tr.active-row td {
  background: #fffaf1;
}

.es-platform[data-theme="dark"] .review-matrix tr.active-row td {
  background: #261f16;
}

.citation-button {
  display: block;
  min-height: 30px;
  margin-bottom: 6px;
  padding: 5px 8px;
  border-color: var(--line-strong);
  background: #f6f8f5;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.es-platform[data-theme="dark"] .citation-button {
  background: #202820;
}

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

.comment-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.comment-card blockquote {
  margin: 0;
  padding: 12px;
  border-left: 4px solid var(--green);
  border-radius: 4px;
  background: var(--green-soft);
  color: #284536;
}

.es-platform[data-theme="dark"] .comment-card blockquote {
  color: #cfe9da;
}

.evidence-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}

.evidence-header select {
  max-width: 420px;
}

.query-block div {
  display: grid;
  gap: 5px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.query-block div:last-child {
  border-bottom: 0;
}

.query-block span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.finding-summary {
  margin-top: 18px;
  padding: 14px;
  border-radius: 8px;
}

.finding-summary.high {
  background: var(--red-soft);
}

.finding-summary.medium {
  background: var(--amber-soft);
}

.finding-summary.low {
  background: var(--green-soft);
}

.finding-summary span {
  display: block;
  font-weight: 800;
}

.export-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 16px;
}

.export-package {
  min-height: 360px;
}

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

.export-option {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  text-transform: none;
}

.export-option input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--green);
}

.export-option strong,
.export-option em {
  display: block;
}

.export-option em {
  color: var(--muted);
  font-style: normal;
  font-weight: 600;
}

.export-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 16px;
}

.storage-tree {
  overflow: auto;
  max-height: 430px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #202821;
  color: #edf6ed;
  font-size: 13px;
  line-height: 1.55;
}

.es-platform[data-theme="dark"] .storage-tree {
  background: #0b100d;
}

.architecture-flow {
  display: grid;
  grid-template-columns: repeat(6, minmax(132px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.architecture-node {
  display: grid;
  gap: 10px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.es-platform[data-theme="dark"] .architecture-node {
  background: var(--surface);
}

.architecture-node span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: var(--plum-soft);
  color: var(--plum);
  font-weight: 900;
}

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

.layer-card {
  min-height: 170px;
}

.layer-card ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.layer-card li {
  margin: 6px 0;
  color: var(--muted);
}

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

.standard-card {
  display: grid;
  gap: 8px;
  min-height: 116px;
  padding: 14px;
  background: var(--surface-2);
}

.standard-card span,
.standard-card em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

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

  .platform-sidebar {
    position: static;
    height: auto;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .screen-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sidebar-footer {
    display: none;
  }

  .dashboard-grid,
  .two-column-screen,
  .viewer-layout,
  .architecture-detail-grid,
  .evidence-layout,
  .export-screen {
    grid-template-columns: 1fr;
  }

  .layer-grid,
  .standards-grid,
  .comment-grid,
  .project-grid,
  .report-grid,
  .portfolio-grid,
  .starter-grid,
  .access-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .workspace-topbar,
  .matrix-controls,
  .viewer-toolbar,
  .evidence-header {
    align-items: stretch;
    flex-direction: column;
  }

  .screen-frame,
  .workspace-topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .screen-nav,
  .kpi-grid,
  .export-stats,
  .layer-grid,
  .standards-grid,
  .comment-grid,
  .project-grid,
  .report-grid,
  .portfolio-grid,
  .starter-grid,
  .access-layout,
  .detail-grid,
  .export-grid,
  .type-strip {
    grid-template-columns: 1fr;
  }

  .nav-item {
    grid-template-columns: 10px 1fr;
  }

  .topbar-cluster {
    justify-content: stretch;
  }

  .topbar-metric,
  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .pipeline-band,
  .architecture-flow {
    grid-template-columns: repeat(6, 180px);
  }

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

  .filter-cluster {
    grid-template-columns: 1fr;
  }

  .document-canvas {
    min-height: 520px;
    padding: 12px;
  }

  .document-page {
    min-height: 500px;
    padding: 20px;
  }

  .document-page p {
    font-size: 15px;
  }

  .page-table {
    grid-template-columns: 1fr;
  }

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

  .project-card,
  .assessment-mini {
    grid-template-columns: 1fr;
  }

  .gap-actions {
    align-items: flex-start;
    flex-direction: row;
  }

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

@media print {
  .platform-sidebar,
  .workspace-topbar,
  .export-actions,
  .screen-nav {
    display: none !important;
  }

  .platform-shell,
  .export-screen,
  .dashboard-grid,
  .two-column-screen {
    display: block;
  }

  .screen-frame {
    padding: 0;
  }

  .workspace-panel,
  .kpi-card {
    box-shadow: none;
    break-inside: avoid;
  }
}
