:root {
  color-scheme: light;
  --ink: #183238;
  --ink-soft: #3e5659;
  --muted: #617476;
  --canvas: #f3f4ef;
  --paper: #fbfaf6;
  --paper-deep: #e9ece6;
  --line: #d4dcd5;
  --line-strong: #aebdb6;
  --teal: #17363b;
  --teal-2: #244a4e;
  --brass: #987746;
  --brass-pale: #eee6d6;
  --blocked: #7a3d37;
  --approved: #285b4d;
  --review: #765e2f;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Aptos", "Segoe UI", "Trebuchet MS", sans-serif;
  --measure: 76rem;
}
.legacy-integrity-panel { padding: .65rem 1.5rem; border-bottom: 1px solid var(--line); background: var(--brass-pale); font: .75rem/1.6 var(--mono); overflow-wrap: anywhere; }
.legacy-integrity-panel span { margin-left: 1rem; }
.legacy-integrity-panel [data-integrity="CURRENT"] { color: var(--approved); }
.legacy-integrity-panel [data-integrity]:not([data-integrity="CURRENT"]) { color: var(--blocked); }
@media print { .legacy-integrity-panel, studio-doc-nav { display:none !important; } }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 6rem; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 16px/1.62 var(--sans);
  text-rendering: optimizeLegibility;
}
a { color: #23585a; text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { color: #102f34; }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid #9a7844; outline-offset: 3px; }
[hidden] { display: none !important; }

.skip-link {
  position: absolute; z-index: 100; top: .5rem; left: .5rem;
  transform: translateY(-160%); padding: .65rem 1rem;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line-strong);
}
.skip-link:focus { transform: translateY(0); }
.doc-masthead {
  min-height: 4.35rem; padding: .75rem clamp(1rem, 3.5vw, 3.5rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  color: #f2f0e9; background: var(--teal); border-bottom: 3px solid var(--brass);
}
.doc-identity { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.doc-mark {
  display: grid; place-items: center; flex: 0 0 2.45rem; height: 2.45rem;
  border: 1px solid #bba477; color: #e4d3ae;
  font: 700 .78rem/1 var(--mono); letter-spacing: -.08em;
}
.doc-identity-name { font-size: .8rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.doc-identity-sub { display: block; margin-top: .1rem; color: #c6d0ca; font: .67rem/1.4 var(--mono); letter-spacing: .035em; }
.doc-actions { display: flex; align-items: center; justify-content: flex-end; gap: .55rem; flex-wrap: wrap; }
.doc-actions a, .doc-actions button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 2.35rem;
  padding: .45rem .7rem; border: 1px solid #547072; color: #e9ece6;
  background: transparent; text-decoration: none; font: 600 .74rem var(--sans); cursor: pointer;
  transition: background .16s ease, transform .16s ease;
}
.doc-actions button { border-color: #bba477; }
.doc-actions a:hover, .doc-actions button:hover { background: #2b5053; transform: translateY(-1px); }
studio-doc-nav { display: block; position: relative; }
.project-nav { position: relative; }
.project-nav > summary {
  display: inline-flex; align-items: center; min-height: 2.35rem; padding: .45rem .7rem;
  border: 1px solid #547072; color: #e9ece6; cursor: pointer; list-style: none;
  font: 600 .74rem var(--sans); white-space: nowrap;
}
.project-nav > summary::-webkit-details-marker { display: none; }
.project-nav > summary::after { content: "⌄"; margin-left: .5rem; color: #d9c69e; }
.project-nav[open] > summary { background: #2b5053; }
.project-nav-links {
  position: absolute; z-index: 20; top: calc(100% + .35rem); right: 0;
  display: grid; grid-template-columns: repeat(2, minmax(10rem, 1fr)); gap: 1px;
  width: min(30rem, calc(100vw - 2rem)); padding: .35rem;
  border: 1px solid #547072; background: var(--teal); box-shadow: 0 8px 20px rgb(13 35 38 / 18%);
}
.project-nav-links a {
  min-height: 2.1rem; padding: .45rem .55rem; color: #e9ece6; font-size: .73rem;
  text-decoration: none;
}
.project-nav-links a:hover { background: #2b5053; color: #fff; }

.doc-intro {
  padding: 1.8rem clamp(1rem, 5vw, 5rem) 1.45rem;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.doc-intro-inner { max-width: var(--measure); margin: auto; }
.doc-kicker, .micro-label {
  color: var(--brass); font: 700 .68rem/1.5 var(--mono);
  letter-spacing: .12em; text-transform: uppercase;
}
.doc-intro h1 {
  margin: .4rem 0 .55rem; color: var(--teal);
  font-size: clamp(1.85rem, 4vw, 3.1rem); line-height: 1.08;
  letter-spacing: -.045em; font-weight: 640; overflow-wrap: anywhere;
}
.doc-deck { max-width: 56rem; margin: 0; color: var(--ink-soft); font-size: .98rem; }
.doc-meta {
  display: flex; flex-wrap: wrap; gap: .45rem .7rem; align-items: center;
  margin-top: 1rem; color: var(--muted);
  font: .69rem/1.5 var(--mono); text-transform: uppercase; letter-spacing: .045em;
  overflow-wrap: anywhere;
}
.doc-meta > * { display: inline-flex; align-items: center; gap: .4rem; }
.doc-meta > * + *::before { content: ""; width: 1px; height: .95rem; margin-right: .15rem; background: var(--line-strong); }
.doc-badge, .status {
  display: inline-flex; align-items: center; min-height: 1.5rem;
  padding: .14rem .5rem; border: 1px solid currentColor;
  color: var(--review); background: #f7f1e5;
  font: 700 .64rem/1.25 var(--mono); letter-spacing: .045em;
}
.status[data-status*="APPROVED"], .status[data-status*="PASS"], .status[data-status="RATIFIED"],
.doc-badge[data-status*="APPROVED"], .doc-badge[data-status*="PASS"], .doc-badge[data-status="RATIFIED"] {
  color: var(--approved); background: #e9f0eb;
}
.status[data-status*="BLOCKED"], .status[data-status*="NOT AUTHORIZED"],
.doc-badge[data-status*="BLOCKED"], .doc-badge[data-status*="NOT AUTHORIZED"] {
  color: var(--blocked); background: #f4e9e6;
}
.status[data-status*="REVIEW"], .status[data-status*="PENDING"],
.doc-badge[data-status*="REVIEW"], .doc-badge[data-status*="PENDING"] {
  color: var(--review); background: #f7f1e5;
}

.integrity-panel {
  max-width: var(--measure); margin: 1rem auto 0; padding: .75rem .9rem;
  border: 1px solid var(--line-strong); background: #f1f0e9;
  display: flex; align-items: flex-start; gap: .7rem; flex-wrap: wrap;
}
.integrity-pill {
  display: inline-flex; align-items: center; min-height: 1.55rem; padding: .12rem .5rem;
  color: #624c25; background: var(--brass-pale); border: 1px solid #b6a178;
  font: 700 .65rem/1.3 var(--mono); letter-spacing: .045em; white-space: nowrap;
}
.integrity-pill[data-integrity="CURRENT"] { color: var(--approved); background: #e9f0eb; border-color: #9cb7a8; }
.integrity-pill[data-integrity="BOOK_STALE"],
.integrity-pill[data-integrity="PROJECT_STATE_STALE"],
.integrity-pill[data-integrity="SOURCE_MISMATCH"],
.integrity-pill[data-integrity="IDENTITY_MISMATCH"],
.integrity-pill[data-integrity="UNAVAILABLE"] { color: var(--blocked); background: #f4e9e6; border-color: #c8a29a; }
.integrity-copy { flex: 1 1 18rem; min-width: min(100%, 15rem); color: var(--ink-soft); font-size: .76rem; }
.integrity-copy p { margin: 0; }
.integrity-warning { margin-top: .2rem !important; color: var(--blocked); font-weight: 650; }

.doc-shell {
  display: grid; grid-template-columns: minmax(15rem, 19rem) minmax(0, 1fr);
  max-width: 104rem; margin: 0 auto; align-items: start;
}
.doc-sidebar {
  position: sticky; top: 0; height: 100dvh; min-height: 32rem; overflow-y: auto;
  padding: 1.15rem .9rem 1.5rem clamp(1rem, 2.5vw, 2rem);
  border-right: 1px solid var(--line); background: #eef0ea;
  scrollbar-color: #aebdb6 transparent; scrollbar-width: thin; z-index: 3;
}
.sidebar-disclosure > summary { display: none; }
.sidebar-content { display: block; }
.sidebar-heading {
  display: flex; align-items: baseline; justify-content: space-between; gap: .6rem;
  margin-bottom: .75rem; padding-bottom: .7rem; border-bottom: 1px solid var(--line-strong);
}
.sidebar-heading h2 { margin: 0; font: 700 .71rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.sidebar-index { color: var(--muted); font: .64rem var(--mono); }
.search-wrap { position: relative; margin-bottom: .6rem; }
.search-wrap label, .filter-wrap label {
  display: block; margin-bottom: .32rem; color: var(--muted); font-size: .71rem; font-weight: 650;
}
.search-wrap input, .filter-wrap select {
  width: 100%; min-height: 2.55rem; padding: .5rem .65rem;
  border: 1px solid var(--line-strong); border-radius: 0; background: var(--paper);
  color: var(--ink); font: .78rem var(--sans);
}
.search-wrap input { padding-right: 4.5rem; }
.search-clear {
  position: absolute; right: .22rem; bottom: .19rem; min-width: 3.4rem; min-height: 2.05rem;
  border: 0; background: transparent; color: var(--teal); cursor: pointer;
  font: .68rem var(--mono); text-decoration: underline; text-underline-offset: .2em;
}
.search-status { min-height: 1.15rem; margin: .2rem 0 .7rem; color: var(--muted); font-size: .68rem; }
.filter-wrap { margin: .75rem 0 1rem; }
.doc-toc { font-size: .77rem; }
.doc-toc details { margin: .12rem 0; }
.doc-toc summary {
  position: relative; padding: .45rem .4rem .45rem 1.4rem;
  color: var(--ink); cursor: pointer; list-style: none; font-weight: 700;
}
.doc-toc summary::-webkit-details-marker { display: none; }
.doc-toc summary::before {
  position: absolute; left: .4rem; top: .45rem; content: "+";
  color: var(--brass); font: .8rem var(--mono);
}
.doc-toc details[open] > summary::before { content: "−"; }
.doc-toc .toc-group-links { display: grid; padding: 0 0 .35rem .45rem; }
.doc-toc a {
  display: block; padding: .32rem .5rem .32rem .65rem; margin: .04rem 0;
  border-left: 2px solid transparent; color: var(--ink-soft);
  text-decoration: none; line-height: 1.42; overflow-wrap: anywhere;
}
.doc-toc a:hover { background: #e4e9e2; color: var(--teal); }
.doc-toc a[aria-current="location"] {
  border-left-color: var(--brass); background: #e6e9e1; color: var(--teal); font-weight: 700;
}
.doc-main { min-width: 0; padding: 1.1rem clamp(1rem, 4vw, 4.4rem) 5rem; }
.reader-tools {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  max-width: 68rem; margin: 0 auto 1.1rem; padding: .55rem 0; border-bottom: 1px solid var(--line);
}
.current-line { color: var(--muted); font: .67rem/1.5 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.current-line strong { color: var(--teal); }
.section-nav { display: flex; gap: .4rem; }
.section-nav a, .section-nav span {
  display: inline-flex; min-height: 2.25rem; align-items: center; justify-content: center;
  padding: .35rem .6rem; border: 1px solid var(--line-strong); background: var(--paper);
  color: var(--ink); font-size: .73rem; text-decoration: none;
}
.section-nav a:hover { border-color: var(--brass); color: var(--teal); }
.section-nav span[aria-disabled="true"] { color: #818d89; }
.reader-section {
  max-width: 68rem; margin: 0 auto 1.25rem; padding: clamp(1.2rem, 3vw, 2.5rem);
  border: 1px solid var(--line); background: var(--paper);
  box-shadow: 0 2px 12px rgb(23 54 59 / 3%); scroll-margin-top: 1rem; overflow-wrap: anywhere;
}
.reader-section[hidden] { display: none !important; }
.reader-section > :first-child { margin-top: 0; }
.reader-section h2 {
  margin: 0 0 1.2rem; padding-bottom: .85rem; border-bottom: 1px solid var(--line);
  color: var(--teal); font-size: clamp(1.45rem, 3vw, 2.25rem);
  line-height: 1.16; letter-spacing: -.035em; font-weight: 640;
}
.reader-section h3, .reader-section h4, .reader-section h5 { color: var(--teal); line-height: 1.3; }
.reader-section h3 { margin: 1.8rem 0 .6rem; font-size: 1.2rem; }
.reader-section h4 { margin: 1.35rem 0 .45rem; font-size: 1.02rem; }
.reader-section p, .reader-section ul, .reader-section ol { margin: .65rem 0 .95rem; }
.reader-section li { margin: .26rem 0; padding-left: .16rem; }
.reader-section blockquote {
  margin: 1.1rem 0; padding: .7rem 1rem; border-left: 2px solid var(--brass);
  background: #f1f0e9; color: var(--ink-soft);
}
.reader-section code, .reader-section pre { font-family: var(--mono); font-size: .88em; }
.reader-section code { padding: .1em .25em; background: #eceee8; overflow-wrap: anywhere; }
.reader-section pre {
  max-width: 100%; overflow: auto; padding: 1rem; background: #e9ece6;
  border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere;
}
.reader-section table {
  width: 100%; border-collapse: collapse; margin: 1.1rem 0 1.4rem;
  font-size: .86rem; line-height: 1.45;
}
.reader-section .table-wrap, .reader-section table { max-width: 100%; }
.reader-section .table-wrap { overflow-x: auto; overscroll-behavior-inline: contain; }
.reader-section .table-wrap:focus-visible { outline: 2px solid var(--brass); }
.reader-section th, .reader-section td {
  padding: .52rem .6rem; border: 1px solid var(--line-strong);
  text-align: left; vertical-align: top; overflow-wrap: anywhere; word-break: normal;
}
.reader-section th { background: #e9ece6; color: var(--teal); font-weight: 700; }
.doc-card, .state-item {
  min-width: 0; padding: 1rem; border: 1px solid var(--line); background: #f7f6f0;
  overflow-wrap: anywhere;
}
.doc-card h3, .state-item h3 { margin-top: 0; }
.card-grid, .state-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: .8rem; margin: 1rem 0;
}
.state-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
.state-item > span { display:block; margin-bottom:.55rem; color:var(--muted); font: .7rem/1.5 var(--mono); }
.state-item > strong { display:block; font-size:.95rem; line-height:1.6; }
.unit {
  margin: .65rem 0; padding: .1rem 0 .1rem .85rem;
  border-left: 2px solid var(--line-strong); min-width: 0;
}
.unit > summary { cursor: pointer; color: var(--teal); font-weight: 700; }
.unit > summary::marker { color: var(--brass); }
.unit .unit { margin-left: .3rem; }
.source-path, .long-id, .reader-section .source-path, .reader-section [data-long-id] {
  max-width: 100%; overflow-wrap: anywhere; word-break: break-word;
}
.source-meta {
  margin-top: 1.3rem; padding-top: .8rem; border-top: 1px solid var(--line);
  color: var(--muted); font-size: .76rem; overflow-wrap: anywhere;
}
.source-meta summary { cursor: pointer; color: var(--teal); font-weight: 700; }
.source-meta > :not(summary) { margin-top: .45rem; }
.source-meta code { overflow-wrap: anywhere; }
.doc-footer {
  max-width: 68rem; margin: 1.7rem auto 0; padding-top: .9rem;
  border-top: 1px solid var(--line-strong); color: var(--muted);
  font: .67rem/1.6 var(--mono);
}

@media (max-width: 900px) {
  .doc-shell { grid-template-columns: minmax(14rem, 16rem) minmax(0, 1fr); }
  .doc-sidebar { padding-left: 1rem; padding-right: .7rem; }
  .doc-main { padding-left: 1rem; padding-right: 1rem; }
}
@media (max-width: 720px) {
  html { scroll-padding-top: 1rem; }
  .doc-masthead { align-items: flex-start; }
  .doc-actions { flex-direction: column; align-items: stretch; }
  .doc-actions a, .doc-actions button { min-height: 2.2rem; text-align: center; }
  .project-nav > summary { min-height: 2.2rem; padding: .36rem; font-size: .67rem; }
  .project-nav-links { right: 0; grid-template-columns: 1fr; }
  .doc-intro { padding-top: 1.4rem; }
  .integrity-panel { margin-left: 0; }
  .doc-shell { display: block; }
  .doc-sidebar {
    position: sticky; top: 0; height: auto; min-height: 0; max-height: min(80dvh, 44rem);
    overflow-y: auto; padding: 0 .8rem; border: 0; border-bottom: 1px solid var(--line-strong);
    box-shadow: 0 3px 10px rgb(23 54 59 / 7%);
  }
  .sidebar-disclosure > summary {
    display: block; padding: .75rem .2rem; color: var(--teal); cursor: pointer; font-weight: 700;
  }
  .sidebar-content { padding: 0 0 .8rem; }
  .sidebar-disclosure:not([open]) .sidebar-content { display: none; }
  .sidebar-heading { display: none; }
  .doc-main { padding-top: .75rem; }
  .reader-tools { align-items: flex-start; flex-direction: column; }
  .section-nav { width: 100%; }
  .section-nav a, .section-nav span { flex: 1; }
  .reader-section { padding: 1.2rem; }
  .reader-section table { min-width: 36rem; font-size: .78rem; }
}
@media (max-width: 440px) {
  .doc-masthead { padding: .7rem; }
  .doc-identity-sub { max-width: 10.5rem; }
  .doc-actions a, .doc-actions button { padding: .36rem; font-size: .67rem; }
  .doc-meta > * + *::before { display: none; }
  .doc-meta { gap: .4rem .6rem; }
  .reader-section th, .reader-section td { padding: .38rem; }
  .integrity-panel { padding: .65rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
@page {
  size: A4;
  margin: 17mm 16mm 18mm;
  @top-left { content: "STUDIO 333 VENTURES  /  INTERNAL GOVERNANCE"; color: #536668; font: 7pt var(--mono); }
  @bottom-left { content: "INTERNAL DOCUMENT  ·  VERIFY CANONICAL SOURCE BEFORE RELIANCE"; color: #536668; font: 6.5pt var(--mono); }
  @bottom-right { content: "PAGE " counter(page); color: #536668; font: 7pt var(--mono); }
}
@media print {
  :root { --canvas: #fff; --paper: #fff; --ink: #182c30; --teal: #17363b; }
  html, body { background: #fff !important; color: #172c30; font-size: 10pt; line-height: 1.35; }
  .skip-link, .doc-actions, .doc-sidebar, .reader-tools { display: none !important; }
  .doc-masthead { min-height: 0; padding: 6mm 0 4mm; color: var(--teal); background: #fff; border-bottom: 1.5pt solid #987746; }
  .doc-mark { color: var(--brass); border-color: var(--brass); }
  .doc-identity-sub { color: #536668; }
  .doc-intro { padding: 12mm 0 8mm; border: 0; }
  .doc-intro h1 { font-size: 28pt; }
  .integrity-panel { margin: 4mm 0; padding: 3mm; break-inside: avoid; }
  .doc-shell { display: block; max-width: none; }
  .doc-main { padding: 0; }
  .reader-section, .reader-section[hidden] {
    display: block !important; max-width: none; margin: 0 0 7mm; padding: 0 0 6mm;
    border: 0; border-bottom: .5pt solid #c7d0ca; box-shadow: none; overflow: visible;
  }
  .reader-section h2 { margin-bottom: 4mm; padding-bottom: 2mm; font-size: 19pt; break-after: avoid; }
  .reader-section h3, .reader-section h4, .reader-section h5 { break-after: avoid; }
  .reader-section p, .reader-section li, .reader-section blockquote { orphans: 3; widows: 3; }
  .reader-section .table-wrap { overflow: visible; }
  .reader-section table { width: 100%; min-width: 0; table-layout: fixed; font-size: 8pt; break-inside: auto; }
  .reader-section tr { break-inside: avoid; }
  .reader-section pre { white-space: pre-wrap; overflow: visible; }
  .reader-section details, .reader-section details[open] { display: block; }
  .reader-section details > summary { list-style: none; }
  .reader-section details > *:not(summary) { display: block !important; }
  .source-meta { display: block; }
  .source-meta > summary { display: none; }
  .source-meta > *:not(summary) { display: block !important; }
  a { color: inherit; text-decoration: none; }
  .status, .doc-badge, .integrity-pill { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .doc-footer { margin-top: 5mm; }
}