:root {
  --ink: #0b2b49;
  --ink-soft: #35556f;
  --paper: #f4f8fb;
  --white: #fff;
  --line: #c7d9e6;
  --cyan: #25a9d8;
  --cyan-soft: #dff3fa;
  --amber: #c96a00;
  --amber-soft: #fff0d7;
  --green: #187458;
  --green-soft: #dff3eb;
  --red: #a44040;
  --red-soft: #fae6e6;
  --shadow: 0 24px 70px rgba(21, 59, 87, .13);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, "Segoe UI", Arial, sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); }
button, a { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: .5rem; left: .5rem; transform: translateY(-160%); z-index: 100; background: var(--ink); color: white; padding: .75rem 1rem; }
.skip-link:focus { transform: none; }
.site-header { min-height: 78px; border-bottom: 1px solid var(--line); padding: 0 clamp(1rem, 4vw, 4.5rem); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2rem; background: rgba(244,248,251,.94); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(16px); }
.brand img { display: block; width: clamp(170px, 15vw, 230px); height: auto; }
.header-context { justify-self: center; display: flex; gap: .55rem; align-items: baseline; color: var(--ink-soft); }
.header-context span { font: 700 .68rem var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.header-context strong { font-size: .86rem; }
.account-slot { min-width: 9rem; display: flex; justify-content: flex-end; }
.account { display: flex; align-items: center; gap: .6rem; }
.account img { width: 34px; height: 34px; border-radius: 50%; border: 2px solid white; box-shadow: 0 0 0 1px var(--line); }
.account small, .account strong { display: block; }
.account small { color: var(--ink-soft); font-size: .68rem; }
.account strong { font-size: .78rem; max-width: 16ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-button { border: 0; background: transparent; text-decoration: underline; cursor: pointer; font-size: .76rem; }

.gateway { min-height: calc(100vh - 78px); padding: clamp(2.5rem, 5vw, 5rem) clamp(1.25rem, 8vw, 9rem) 3rem; overflow: hidden; position: relative; }
.gateway::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .44; background-image: linear-gradient(rgba(38,122,164,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(38,122,164,.07) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(circle at 68% 42%, black, transparent 70%); }
.gateway-grid { max-width: 1320px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, .95fr) minmax(430px, 1.05fr); gap: clamp(3rem, 8vw, 8rem); align-items: center; position: relative; }
.eyebrow { margin: 0 0 1rem; color: var(--amber); font: 700 .72rem/1.4 var(--mono); letter-spacing: .16em; text-transform: uppercase; }
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -.035em; }
.gateway h1 { margin: 0; max-width: 820px; font-size: clamp(3.1rem, 5vw, 5.7rem); line-height: .94; }
.lede { max-width: 700px; margin: 1.5rem 0; color: var(--ink-soft); font-size: clamp(1.05rem, 1.4vw, 1.28rem); line-height: 1.65; }
.button { border: 1px solid var(--ink); border-radius: 999px; min-height: 48px; padding: .72rem 1.2rem; display: inline-flex; align-items: center; justify-content: center; gap: .65rem; cursor: pointer; font-weight: 700; transition: transform .2s ease, box-shadow .2s ease, background .2s ease; }
.button:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(11,43,73,.16); }
.button.primary { background: var(--ink); color: white; }
.button.secondary { background: white; color: var(--ink); }
.button svg { width: 20px; height: 20px; background: white; border-radius: 50%; padding: 2px; }
.microcopy { max-width: 520px; color: var(--ink-soft); font-size: .8rem; line-height: 1.55; }
.access-orbit { min-height: 590px; position: relative; display: grid; place-items: center; }
.orbit-core { width: 190px; height: 190px; border-radius: 50%; display: grid; place-content: center; text-align: center; color: white; background: radial-gradient(circle at 35% 30%, #245d84, var(--ink)); box-shadow: 0 0 0 14px rgba(37,169,216,.09), var(--shadow); z-index: 2; }
.orbit-core span { font: 700 .65rem var(--mono); letter-spacing: .18em; }
.orbit-core strong { margin-top: .4rem; font: 500 2.1rem var(--serif); }
.orbit-ring { position: absolute; border: 1px solid rgba(37,169,216,.45); border-radius: 50%; transform: rotate(-14deg); }
.ring-one { width: 410px; height: 270px; animation: orbitPulse 7s ease-in-out infinite; }
.ring-two { width: 560px; height: 390px; border-color: rgba(201,106,0,.28); transform: rotate(19deg); animation: orbitPulse 8s 1s ease-in-out infinite reverse; }
.orbit-card { position: absolute; z-index: 3; min-width: 190px; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.92); box-shadow: 0 16px 40px rgba(25,70,100,.1); }
.orbit-card span { color: var(--amber); font: 700 .67rem var(--mono); }
.orbit-card strong, .orbit-card small { display: block; }
.orbit-card strong { margin: .35rem 0 .2rem; font-size: .95rem; }
.orbit-card small { color: var(--ink-soft); }
.card-identity { left: 0; top: 16%; }
.card-review { right: 0; top: 42%; }
.card-record { left: 8%; bottom: 8%; }
@keyframes orbitPulse { 50% { transform: rotate(2deg) scale(1.025); opacity: .75; } }
.boundary-note { max-width: 1320px; margin: 5rem auto 0; display: grid; grid-template-columns: auto 1fr 60px auto 1fr; align-items: center; gap: 1rem; border-top: 1px solid var(--line); padding-top: 1.25rem; position: relative; }
.boundary-note span { font: 700 .68rem var(--mono); letter-spacing: .12em; color: var(--amber); }
.boundary-note p { margin: 0; color: var(--ink-soft); font-size: .83rem; }
.boundary-note i { height: 1px; background: var(--line); }

.state-view { min-height: calc(100vh - 78px); display: grid; place-items: center; padding: 3rem 1.25rem; }
.state-card { width: min(680px, 100%); padding: clamp(2rem, 5vw, 4.5rem); background: white; border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); text-align: center; }
.state-card h1 { margin: .5rem auto 1rem; font-size: clamp(2.4rem, 5vw, 4.3rem); line-height: 1; }
.state-card > p:not(.eyebrow) { color: var(--ink-soft); line-height: 1.65; }
.status-mark { width: 70px; height: 70px; margin: 0 auto 1.5rem; border-radius: 50%; display: grid; place-items: center; color: var(--amber); background: var(--amber-soft); font: 700 1.7rem var(--mono); }
.status-mark.revoked { color: var(--red); background: var(--red-soft); }
.spinner { width: 48px; height: 48px; margin: 0 auto 1.5rem; border: 3px solid var(--cyan-soft); border-top-color: var(--cyan); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.identity-summary { margin: 2rem 0; border-block: 1px solid var(--line); padding: 1rem 0; text-align: left; }
.identity-summary div { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; padding: .5rem 0; }
.identity-summary dt { color: var(--ink-soft); font: 700 .67rem var(--mono); letter-spacing: .1em; }
.identity-summary dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

.dashboard { max-width: 1540px; margin: 0 auto; padding: clamp(2rem, 5vw, 5rem) clamp(1rem, 5vw, 5rem) 6rem; }
.dashboard-hero { padding: clamp(2rem, 5vw, 4.5rem); border-radius: 28px; color: white; background: linear-gradient(120deg, #0a2b49, #113e63 62%, #155878); display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; position: relative; overflow: hidden; }
.dashboard-hero::after { content: ""; position: absolute; inset: auto -8% -55% 35%; height: 120%; border: 1px solid rgba(93,207,243,.35); border-radius: 50%; transform: rotate(-8deg); box-shadow: 0 0 0 36px rgba(93,207,243,.045), 0 0 0 72px rgba(93,207,243,.035); }
.dashboard-hero h1 { margin: .3rem 0 1rem; max-width: 850px; font-size: clamp(2.7rem, 5vw, 5.3rem); line-height: .96; position: relative; z-index: 1; }
.dashboard-hero p:not(.eyebrow) { max-width: 780px; color: #d8e8f4; line-height: 1.6; position: relative; z-index: 1; }
.system-state { min-width: 180px; position: relative; z-index: 2; border: 1px solid rgba(255,255,255,.2); border-radius: 18px; padding: 1rem; display: flex; align-items: center; gap: .8rem; background: rgba(5,26,44,.38); backdrop-filter: blur(10px); }
.pulse { width: 12px; height: 12px; background: #54e1ad; border-radius: 50%; box-shadow: 0 0 0 8px rgba(84,225,173,.13); }
.system-state small, .system-state strong { display: block; }
.system-state small { font: 700 .58rem var(--mono); letter-spacing: .12em; color: #a9c9dc; }
.system-state strong { margin-top: .25rem; }
.dashboard-nav { margin: 1.25rem 0 2rem; padding: .35rem; border: 1px solid var(--line); border-radius: 999px; display: inline-flex; flex-wrap: wrap; gap: .2rem; background: white; }
.dashboard-nav button, .dashboard-nav .programme-link { border: 0; border-radius: 999px; background: transparent; padding: .7rem 1rem; color: inherit; cursor: pointer; font-weight: 700; text-decoration: none; }
.dashboard-nav .programme-link { color: var(--ink); background: var(--cyan-soft); box-shadow: inset 0 0 0 1px var(--cyan); }
.dashboard-nav button.active { color: white; background: var(--ink); }
.panel { display: none; }
.panel.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.metric { min-height: 170px; padding: 1.35rem; border: 1px solid var(--line); border-radius: 20px; background: white; }
.metric span { color: var(--ink-soft); font: 700 .64rem var(--mono); letter-spacing: .12em; }
.metric strong { display: block; margin: 1.5rem 0 .25rem; font: 500 clamp(2rem, 3vw, 3.1rem) var(--serif); }
.metric p { margin: 0; color: var(--ink-soft); font-size: .8rem; line-height: 1.45; }
.control-chain, .resource-section, .record-layout, .member-admin { margin-top: 1rem; padding: clamp(1.5rem, 4vw, 3.5rem); border: 1px solid var(--line); border-radius: 24px; background: white; }
.section-heading { margin-bottom: 2rem; display: flex; align-items: end; justify-content: space-between; gap: 2rem; }
.section-heading h2, .record-layout h2 { margin: 0; font-size: clamp(2.2rem, 4vw, 4rem); line-height: 1; }
.section-heading > p { max-width: 430px; color: var(--ink-soft); line-height: 1.55; }
.chain-grid { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; align-items: stretch; gap: .7rem; }
.chain-grid article { padding: 1.15rem; background: var(--paper); border-radius: 16px; }
.chain-grid article span { color: var(--amber); font: 700 .61rem var(--mono); letter-spacing: .08em; }
.chain-grid article strong { display: block; margin: .8rem 0 .4rem; }
.chain-grid article p { margin: 0; color: var(--ink-soft); font-size: .78rem; line-height: 1.5; }
.chain-grid > i { align-self: center; color: var(--cyan); font-style: normal; }
.resource-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.resource-card { min-height: 250px; padding: 1.4rem; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(180deg, white, #f7fafc); display: flex; flex-direction: column; }
.resource-card .meta { display: flex; justify-content: space-between; gap: 1rem; color: var(--ink-soft); font: 700 .62rem var(--mono); letter-spacing: .08em; }
.resource-card h3 { margin: 1.3rem 0 .7rem; font: 500 1.65rem/1.05 var(--serif); }
.resource-card p { color: var(--ink-soft); line-height: 1.55; font-size: .85rem; }
.resource-card button { margin-top: auto; align-self: flex-start; border: 0; border-bottom: 1px solid currentColor; background: transparent; padding: .3rem 0; cursor: pointer; color: #087ca9; font-weight: 800; }
.empty { grid-column: 1 / -1; padding: 2rem; border: 1px dashed var(--line); border-radius: 16px; color: var(--ink-soft); }
.record-layout { display: grid; grid-template-columns: minmax(260px, .7fr) minmax(0, 1.3fr); gap: clamp(2rem, 6vw, 6rem); }
.record-layout aside > p:not(.eyebrow) { color: var(--ink-soft); line-height: 1.6; }
.timeline { border-left: 1px solid var(--line); padding-left: 2rem; }
.timeline-item { position: relative; padding: 0 0 2.2rem; }
.timeline-item::before { content: ""; position: absolute; left: calc(-2rem - 5px); top: .3rem; width: 9px; height: 9px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 5px var(--cyan-soft); }
.timeline-item span { color: var(--amber); font: 700 .65rem var(--mono); letter-spacing: .1em; }
.timeline-item h3 { margin: .55rem 0 .4rem; font: 500 1.7rem var(--serif); }
.timeline-item p { margin: 0; color: var(--ink-soft); line-height: 1.55; }
.member-list { display: grid; gap: .75rem; }
.member-row { padding: 1rem; border: 1px solid var(--line); border-radius: 16px; display: grid; grid-template-columns: auto 1fr auto auto; gap: 1rem; align-items: center; }
.member-row img, .avatar-fallback { width: 44px; height: 44px; border-radius: 50%; }
.avatar-fallback { display: grid; place-items: center; color: white; background: var(--ink); font-weight: 800; }
.member-row strong, .member-row small { display: block; }
.member-row small { color: var(--ink-soft); margin-top: .2rem; }
.status-pill { padding: .35rem .6rem; border-radius: 999px; font: 700 .62rem var(--mono); text-transform: uppercase; letter-spacing: .08em; background: var(--amber-soft); color: var(--amber); }
.status-pill.approved { background: var(--green-soft); color: var(--green); }
.status-pill.revoked { background: var(--red-soft); color: var(--red); }
.member-actions { display: flex; gap: .5rem; }
.member-actions button { border: 1px solid var(--line); border-radius: 999px; padding: .5rem .75rem; background: white; cursor: pointer; font-weight: 700; font-size: .75rem; }
.reader { width: min(980px, calc(100% - 2rem)); max-height: 90vh; border: 0; border-radius: 22px; padding: 0; box-shadow: 0 30px 90px rgba(3,25,43,.35); }
.reader::backdrop { background: rgba(4,27,46,.72); backdrop-filter: blur(5px); }
.reader > form { position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; padding: .75rem; background: white; border-bottom: 1px solid var(--line); }
.reader > form button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: white; cursor: pointer; font-size: 1.5rem; }
#reader-content { padding: clamp(1.5rem, 5vw, 4rem); }
#reader-content h1 { font-size: clamp(2.6rem, 6vw, 5.2rem); line-height: .95; margin: 0 0 1rem; }
#reader-content .report-dek { color: var(--ink-soft); font-size: 1.12rem; line-height: 1.65; border-bottom: 1px solid var(--line); padding-bottom: 2rem; }
#reader-content section { padding: 2rem 0; border-bottom: 1px solid var(--line); }
#reader-content section h2 { margin: 0 0 1rem; font-size: 2rem; }
#reader-content section p { color: var(--ink-soft); line-height: 1.75; white-space: pre-line; }
.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; max-width: 380px; padding: .9rem 1rem; border-radius: 12px; color: white; background: var(--ink); box-shadow: var(--shadow); transform: translateY(160%); transition: transform .25s ease; }
.toast.show { transform: none; }

@media (max-width: 1050px) {
  .header-context { display: none; }
  .gateway-grid { grid-template-columns: 1fr; }
  .access-orbit { min-height: 520px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .chain-grid { grid-template-columns: 1fr 1fr; }
  .chain-grid > i { display: none; }
  .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-layout { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .site-header { grid-template-columns: 1fr auto; min-height: 68px; padding: 0 1rem; }
  .brand img { width: 160px; }
  .account strong { max-width: 9ch; }
  .gateway { padding-inline: 1rem; }
  .gateway h1 { font-size: clamp(3rem, 15vw, 4.6rem); }
  .access-orbit { min-height: 470px; transform: scale(.88); margin-inline: -2rem; }
  .ring-two { width: 440px; }
  .ring-one { width: 330px; }
  .orbit-card { min-width: 160px; }
  .boundary-note { grid-template-columns: auto 1fr; }
  .boundary-note i { display: none; }
  .metric-grid, .resource-grid, .chain-grid { grid-template-columns: 1fr; }
  .dashboard { padding-inline: .75rem; }
  .dashboard-hero { display: block; }
  .system-state { margin-top: 2rem; width: fit-content; }
  .dashboard-nav { border-radius: 18px; width: 100%; }
  .dashboard-nav button, .dashboard-nav .programme-link { flex: 1 1 45%; text-align: center; }
  .section-heading { display: block; }
  .member-row { grid-template-columns: auto 1fr; }
  .status-pill, .member-actions { grid-column: 2; }
}

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

/* Authenticated research workspace */
.dashboard { max-width: 1680px; }
.dashboard-nav { position: sticky; top: 88px; z-index: 12; max-width: calc(100vw - 2rem); overflow-x: auto; flex-wrap: nowrap; box-shadow: 0 12px 30px rgba(11,43,73,.07); }
.dashboard-nav button, .dashboard-nav .programme-link { white-space: nowrap; }
.metric-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.metric { min-height: 188px; }
.metric strong { font-size: clamp(1.65rem, 2.4vw, 2.7rem); overflow-wrap: anywhere; }
.workspace-section { margin-top: 1rem; padding: clamp(1.5rem, 4vw, 3.5rem); border: 1px solid var(--line); border-radius: 24px; background: white; }
.corpus-map { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; counter-reset: corpus; }
.corpus-card { min-height: 185px; padding: 1.35rem; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, #f8fbfd, #eef6fa); }
.corpus-card > span, .subsystem-code, .diagnostic-card > span, .pending-card-record > span, .figure-category { color: var(--amber); font: 700 .65rem var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.corpus-card h3, .diagnostic-card h3, .pending-card-record h3 { margin: 1rem 0 .65rem; font: 500 1.6rem/1.05 var(--serif); }
.corpus-card p, .diagnostic-card p, .pending-card-record p { margin: 0; color: var(--ink-soft); font-size: .85rem; line-height: 1.6; }

.architecture-section { overflow: hidden; background: linear-gradient(145deg, #071f35, #0d3859); color: white; border-color: #214b68; }
.architecture-section .section-heading > p { color: #bcd3e2; }
.architecture-map { min-width: 1000px; border: 1px solid rgba(255,255,255,.12); border-radius: 20px; overflow: hidden; background-image: linear-gradient(rgba(101,184,221,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(101,184,221,.06) 1px, transparent 1px); background-size: 32px 32px; }
.architecture-map svg { display: block; width: 100%; height: auto; color: #8dd8f2; }
.flow-edge { fill: none; stroke: currentColor; stroke-width: 2; stroke-dasharray: 5 10; animation: flowLine 1.7s linear infinite; opacity: .78; }
.flow-edge.decision { color: #f4b969; stroke-width: 2.5; }
.flow-edge.command { color: #ff8c64; stroke-width: 2.7; }
.flow-edge.feedback { color: #5ce0af; stroke-width: 2.2; opacity: .68; }
@keyframes flowLine { to { stroke-dashoffset: -30; } }
.system-node rect { fill: #0d2f4c; stroke: #3c718f; stroke-width: 1.2; }
.system-node:hover rect { stroke: #8dd8f2; fill: #123d60; }
.node-code { fill: #6fc5e7; font: 700 12px var(--mono); letter-spacing: .12em; }
.node-title { fill: white; font: 700 16px var(--sans); }
.node-detail { fill: #b9d1df; font: 12px var(--sans); }
.architecture-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; color: #bfd4e1; font: 700 .68rem var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.architecture-legend span::before { content: ""; display: inline-block; width: 28px; margin-right: .5rem; border-top: 2px dashed currentColor; vertical-align: middle; }
.architecture-legend .measurement { color: #8dd8f2; }.architecture-legend .decision { color: #f4b969; }.architecture-legend .command { color: #ff8c64; }.architecture-legend .feedback { color: #5ce0af; }

.subsystem-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.subsystem-card { padding: 1.4rem; border: 1px solid var(--line); border-radius: 18px; background: #f8fbfd; }
.subsystem-card h3 { margin: .85rem 0 1.25rem; font: 500 1.65rem/1.05 var(--serif); }
.subsystem-card dl { margin: 0; display: grid; grid-template-columns: 6rem 1fr; gap: .65rem .8rem; }
.subsystem-card dt { color: var(--amber); font: 700 .61rem var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.subsystem-card dd { margin: 0; color: var(--ink-soft); font-size: .82rem; line-height: 1.5; }
.az-timeline .timeline-item p { white-space: pre-line; }
.diagnostic-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.diagnostic-card { padding: 1.35rem; border: 1px solid var(--line); border-radius: 18px; background: #f8fbfd; }

.runtime-summary { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; margin-bottom: 1.5rem; }
.runtime-summary > div { padding: 1.2rem; border-right: 1px solid var(--line); background: #f8fbfd; }
.runtime-summary > div:last-child { border-right: 0; }
.runtime-summary span, .library-tools label > span { display: block; color: var(--ink-soft); font: 700 .62rem var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.runtime-summary strong { display: block; margin-top: .6rem; font: 500 1.55rem var(--serif); }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.data-table th, .data-table td { padding: .9rem .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; line-height: 1.45; }
.data-table thead th { color: var(--ink-soft); background: #edf5f9; font: 700 .63rem var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.data-table tbody tr:hover { background: #f7fbfd; }
.pending-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.pending-card-record { padding: 1.25rem; border: 1px dashed #b8ccd9; border-radius: 18px; }

.library-tools { display: grid; grid-template-columns: minmax(260px, 1fr) 190px 260px auto; gap: .8rem; align-items: end; margin-bottom: 1.25rem; padding: 1rem; border-radius: 18px; background: #edf5f9; }
.library-tools label { display: block; }
.library-tools input, .library-tools select { width: 100%; min-height: 46px; margin-top: .45rem; padding: .65rem .75rem; border: 1px solid #aec7d7; border-radius: 10px; color: var(--ink); background: white; }
.library-tools > strong { min-height: 46px; display: grid; place-items: center; padding: .5rem .8rem; border-radius: 10px; color: white; background: var(--ink); font-size: .78rem; white-space: nowrap; }
.library-list { display: grid; gap: .7rem; }
.library-card { display: grid; grid-template-columns: minmax(150px, .7fr) minmax(260px, 1.2fr) minmax(280px, 1.5fr) auto; gap: 1rem; align-items: center; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(90deg, #fff, #f8fbfd); }
.library-card .meta { display: grid; gap: .35rem; color: var(--ink-soft); font: 700 .6rem var(--mono); letter-spacing: .08em; }
.library-card h3 { margin: 0; font: 500 1.25rem/1.12 var(--serif); }
.library-preview { margin: 0; color: var(--ink-soft); font-size: .76rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.library-path { display: none; }
.library-card button, .figure-card button { border: 0; border-bottom: 1px solid currentColor; padding: .25rem 0; color: #087ca9; background: transparent; cursor: pointer; font-weight: 800; font-size: .76rem; white-space: nowrap; }

.figure-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.figure-grid.featured { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.figure-card { min-height: 305px; padding: .9rem; border: 1px solid var(--line); border-radius: 18px; background: #f8fbfd; display: flex; flex-direction: column; }
.figure-media { aspect-ratio: 16/10; margin-bottom: 1rem; overflow: hidden; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(145deg, #0b2b49, #174f75); }
.figure-media img { width: 100%; height: 100%; object-fit: contain; background: white; }
.figure-placeholder { color: #a9d5e8; font: 700 .65rem var(--mono); letter-spacing: .15em; }
.figure-card h3 { margin: .55rem 0 .7rem; font: 500 1.2rem/1.12 var(--serif); overflow-wrap: anywhere; }
.figure-card button { margin-top: auto; align-self: flex-start; }
.figure-tools { grid-template-columns: minmax(280px, 1fr) auto; }

.reader { width: min(1440px, calc(100% - 2rem)); height: min(94vh, 1050px); max-height: 94vh; }
.reader-toolbar { position: sticky; top: 0; z-index: 5; min-height: 68px; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line); background: white; }
.reader-toolbar > div span, .reader-toolbar > div strong { display: block; }
.reader-toolbar > div span { color: var(--amber); font: 700 .61rem var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.reader-toolbar > div strong { margin-top: .2rem; font-size: .83rem; }
.reader-toolbar form { margin: 0; }
.reader-toolbar form button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: white; cursor: pointer; font-size: 1.5rem; }
#reader-content { min-height: calc(100% - 68px); padding: clamp(1rem, 3vw, 2.5rem); }
.pdf-frame { width: 100%; height: calc(94vh - 155px); border: 1px solid var(--line); border-radius: 12px; background: #222; }
.reader-image { display: block; max-width: 100%; height: auto; margin: 1rem auto; border: 1px solid var(--line); border-radius: 12px; background: white; }
.reader-loading { min-height: 50vh; display: grid; place-items: center; color: var(--ink-soft); }
.reader-file-actions { display: flex; justify-content: flex-end; margin-bottom: .8rem; }
.markdown-report { width: min(920px, 100%); margin: 0 auto; padding: clamp(1rem, 4vw, 3rem); color: #173a55; background: white; }
.markdown-report h2 { margin: 2.4rem 0 .9rem; padding-top: 1.5rem; border-top: 1px solid var(--line); font-size: clamp(2rem, 4vw, 3.1rem); }
.markdown-report h3 { margin: 1.8rem 0 .7rem; font: 500 1.7rem var(--serif); }
.markdown-report h4 { margin: 1.4rem 0 .6rem; font-size: 1.05rem; }
.markdown-report p, .markdown-report li { color: #35556f; line-height: 1.75; }
.markdown-report pre { overflow-x: auto; padding: 1rem; border-radius: 12px; color: #d8edf7; background: #08253d; }
.reader-table { width: 100%; border-collapse: collapse; margin: 1rem 0 2rem; font-size: .8rem; }
.reader-table th, .reader-table td { padding: .7rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.reader-table th { background: #edf5f9; }

@media (max-width: 1350px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .diagnostic-grid, .figure-grid, .figure-grid.featured, .pending-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-card { grid-template-columns: .65fr 1fr 1.2fr auto; }
}

@media (max-width: 960px) {
  .dashboard-nav { top: 74px; }
  .corpus-map, .subsystem-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .architecture-section { overflow-x: auto; }
  .library-tools { grid-template-columns: 1fr 1fr; }
  .library-card { grid-template-columns: 1fr; align-items: start; }
  .library-card .meta { grid-template-columns: auto auto; justify-content: start; gap: 1rem; }
  .runtime-summary { grid-template-columns: repeat(2, 1fr); }
  .runtime-summary > div:nth-child(2) { border-right: 0; }
  .runtime-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 680px) {
  .metric-grid, .corpus-map, .subsystem-grid, .diagnostic-grid, .figure-grid, .figure-grid.featured, .pending-grid { grid-template-columns: 1fr; }
  .library-tools, .figure-tools { grid-template-columns: 1fr; }
  .runtime-summary { grid-template-columns: 1fr; }
  .runtime-summary > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .runtime-summary > div:last-child { border-bottom: 0; }
  .reader { width: 100%; height: 100vh; max-height: 100vh; border-radius: 0; }
  .pdf-frame { height: calc(100vh - 165px); }
}
