:root {
    color-scheme: light;
    --ink: #152f2d;
    --muted: #647875;
    --paper: #f7f7f2;
    --surface: #ffffff;
    --line: #dce4df;
    --brand: #0c6b60;
    --brand-deep: #084a43;
    --accent: #dff3eb;
    --warning: #8b5c12;
    --shadow: 0 18px 50px rgba(17, 55, 50, 0.1);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.entry-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    background:
        radial-gradient(circle at 12% 18%, rgba(126, 205, 184, 0.24), transparent 32rem),
        linear-gradient(135deg, #f8faf5 0%, #edf5f0 100%);
}
.entry-hero { padding: clamp(2rem, 7vw, 7rem); display: flex; flex-direction: column; justify-content: space-between; gap: 4rem; }
.brand { display: inline-flex; align-items: center; gap: .8rem; font-weight: 750; letter-spacing: .04em; }
.brand-mark { width: 2.5rem; height: 2.5rem; display: grid; place-items: center; border-radius: .8rem; color: white; background: var(--brand); box-shadow: 0 8px 24px rgba(12, 107, 96, .24); }
.eyebrow { margin: 0 0 1rem; color: var(--brand); font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 14ch; margin-bottom: 1.5rem; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3rem, 7vw, 6.7rem); font-weight: 500; line-height: .97; letter-spacing: -.045em; }
.entry-lead { max-width: 40rem; color: var(--muted); font-size: clamp(1rem, 1.8vw, 1.25rem); line-height: 1.7; }
.entry-panel { margin: clamp(1rem, 4vw, 3rem); padding: clamp(2rem, 5vw, 4rem); align-self: center; border: 1px solid rgba(255,255,255,.8); border-radius: 2rem; background: rgba(255,255,255,.86); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.entry-panel h2 { font-size: 1.6rem; }
.status-row { display: flex; align-items: center; gap: .65rem; margin: 1.6rem 0; color: var(--brand-deep); font-weight: 700; }
.status-dot { width: .65rem; height: .65rem; border-radius: 50%; background: #22a77e; box-shadow: 0 0 0 .35rem #e1f6ee; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 3rem; padding: .75rem 1.2rem; border: 0; border-radius: .8rem; color: white; background: var(--brand); font-weight: 750; text-decoration: none; }
.button:hover { background: var(--brand-deep); }
.fine-print { margin: 1.2rem 0 0; color: var(--muted); font-size: .86rem; line-height: 1.55; }

.app-page { min-height: 100vh; display: grid; grid-template-columns: 17rem 1fr; background: #f4f6f2; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 1.5rem 1rem; color: #eaf4f1; background: #102f2c; }
.sidebar .brand { padding: .4rem .7rem 1.8rem; color: white; }
.nav-label { margin: 1rem .75rem .55rem; color: #88aaa5; font-size: .68rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.navigation { display: grid; gap: .3rem; }
.nav-item { width: 100%; display: flex; align-items: center; gap: .75rem; padding: .78rem .85rem; border: 0; border-radius: .7rem; color: #bcd0cd; background: transparent; font: inherit; font-size: .92rem; text-align: left; cursor: pointer; }
.nav-item:hover, .nav-item.is-active { color: white; background: rgba(255,255,255,.1); }
.nav-icon { width: 1.65rem; color: #77b9ad; font-size: .7rem; font-weight: 900; letter-spacing: .04em; }
.workspace { min-width: 0; }
.topbar { min-height: 5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1.2rem, 4vw, 3rem); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); }
.environment { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .82rem; }
.environment::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: #22a77e; }
.context-pill { padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: white; font-size: .78rem; }
.workspace-content { padding: clamp(1.4rem, 4vw, 3.5rem); }
.panel-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.panel-heading h1 { max-width: none; margin: 0; font-family: inherit; font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 750; line-height: 1.05; letter-spacing: -.04em; }
.panel-heading p { max-width: 42rem; margin: .75rem 0 0; color: var(--muted); line-height: 1.6; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.card { min-height: 12rem; padding: 1.4rem; border: 1px solid var(--line); border-radius: 1.15rem; background: var(--surface); box-shadow: 0 8px 28px rgba(23, 56, 51, .05); }
.card-kicker { color: var(--brand); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.card h3 { margin: .8rem 0 .6rem; font-size: 1.08rem; }
.card p { color: var(--muted); line-height: 1.55; }
.placeholder { max-width: 48rem; padding: clamp(2rem, 5vw, 4rem); border: 1px dashed #b8c9c4; border-radius: 1.4rem; background: rgba(255,255,255,.65); }
.placeholder-badge { display: inline-block; margin-bottom: 1rem; padding: .35rem .6rem; border-radius: 999px; color: var(--warning); background: #fff2d8; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.placeholder h2 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
.placeholder p { color: var(--muted); line-height: 1.7; }
[hidden] { display: none !important; }

@media (max-width: 900px) {
    .entry-page { grid-template-columns: 1fr; }
    .entry-panel { margin-top: 0; }
    .app-page { grid-template-columns: 1fr; }
    .sidebar { position: static; width: 100%; height: auto; }
    .navigation { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .entry-hero { padding: 1.5rem; }
    .entry-panel { margin: 1rem; padding: 1.5rem; }
    .navigation { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; flex-direction: column; }
}

:focus-visible { outline: 3px solid #74cdbb; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }

/* Clinical UI Foundation */
.clinical-app { min-height: 100vh; display: grid; grid-template-columns: 17.5rem minmax(0, 1fr); background: #f3f6f3; }
.clinical-sidebar { position: sticky; top: 0; height: 100vh; padding: 1.4rem 1rem; color: #e9f4f0; background: #102d2b; }
.clinical-brand { padding: .35rem .65rem 1.8rem; color: white; text-decoration: none; }
.clinical-brand span:last-child { display: grid; gap: .1rem; }
.clinical-brand small { color: #91aea9; font-size: .68rem; font-weight: 600; letter-spacing: .04em; }
.clinical-navigation { display: grid; gap: .3rem; }
.clinical-nav-item { width: 100%; min-height: 3rem; display: grid; grid-template-columns: 2rem 1fr; align-items: center; gap: .65rem; padding: .7rem .8rem; border: 0; border-radius: .75rem; color: #b9cfca; background: transparent; font: inherit; text-align: left; cursor: pointer; }
.clinical-nav-item > span { color: #6ea99f; font-size: .65rem; letter-spacing: .08em; }
.clinical-nav-item > strong { font-size: .88rem; font-weight: 650; }
.clinical-nav-item:hover, .clinical-nav-item.is-active { color: white; background: rgba(255, 255, 255, .1); }
.clinical-workspace { min-width: 0; }
.clinical-header { min-height: 4.8rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem clamp(1.2rem, 4vw, 3rem); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .92); }
.header-caption { margin: .25rem 0 0; color: var(--muted); font-size: .76rem; }
.session-state { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 999px; color: var(--brand-deep); background: white; font-size: .78rem; font-weight: 700; }
.session-state span { width: .48rem; height: .48rem; border-radius: 50%; background: #22a77e; box-shadow: 0 0 0 .25rem #e1f6ee; }
.patient-context-banner { display: flex; justify-content: space-between; gap: 2rem; padding: 1.4rem clamp(1.2rem, 4vw, 3rem); border-bottom: 1px solid #c8ded7; background: linear-gradient(110deg, #e8f5ef, #f8fbf9); }
.context-label { margin: 0 0 .35rem; color: var(--brand); font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.patient-context-banner h1 { max-width: none; margin: 0 0 .35rem; font-family: inherit; font-size: 1.25rem; font-weight: 750; letter-spacing: -.02em; }
.patient-context-banner p { margin: 0; color: var(--muted); font-size: .84rem; }
.context-permissions { max-width: 42rem; text-align: right; }
.context-permissions > span { color: var(--muted); font-size: .7rem; font-weight: 750; text-transform: uppercase; }
.context-permissions ul { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; margin: .45rem 0 0; padding: 0; list-style: none; }
.context-permissions li { padding: .3rem .5rem; border: 1px solid #c6ded6; border-radius: 999px; color: var(--brand-deep); background: rgba(255,255,255,.75); font-size: .67rem; }
.context-permissions p { margin-top: .45rem; }
.clinical-content { padding: clamp(1.4rem, 4vw, 3.5rem); }
.clinical-content .panel-heading h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.15rem); letter-spacing: -.045em; }
.foundation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.foundation-card { min-height: 12rem; padding: 1.4rem; border: 1px solid var(--line); border-radius: 1rem; background: white; box-shadow: 0 8px 28px rgba(23, 56, 51, .05); }
.foundation-card > span { color: var(--brand); font-size: .68rem; font-weight: 850; letter-spacing: .1em; }
.foundation-card h3 { margin: 1.5rem 0 .55rem; font-size: 1.05rem; }
.foundation-card p { color: var(--muted); line-height: 1.55; }
.safe-placeholder { max-width: 50rem; padding: clamp(2rem, 6vw, 5rem); border: 1px dashed #afc6c0; border-radius: 1.25rem; background: rgba(255, 255, 255, .7); }
.safe-placeholder > span { display: inline-block; margin-bottom: 1rem; padding: .32rem .55rem; border-radius: 999px; color: var(--warning); background: #fff2d8; font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.safe-placeholder h2 { margin-bottom: .75rem; font-size: clamp(1.8rem, 4vw, 2.7rem); }
.safe-placeholder p { color: var(--muted); line-height: 1.65; }
.access-state-page { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; background: radial-gradient(circle at 20% 20%, #e3f3ec, transparent 34rem), #f5f7f3; }
.access-state-card { width: min(100%, 38rem); padding: clamp(2rem, 6vw, 4rem); border: 1px solid var(--line); border-radius: 1.5rem; background: white; box-shadow: var(--shadow); }
.access-state-card .brand { margin-bottom: 3.5rem; text-decoration: none; }
.access-state-card h1 { max-width: none; margin-bottom: 1rem; font-family: inherit; font-size: clamp(2rem, 6vw, 3.5rem); font-weight: 750; line-height: 1.05; }
.access-state-card > p:not(.eyebrow):not(.fine-print) { color: var(--muted); font-size: 1.02rem; line-height: 1.65; }

@media (max-width: 960px) {
    .clinical-app { grid-template-columns: 1fr; }
    .clinical-sidebar { position: static; width: 100%; height: auto; }
    .clinical-brand { padding-bottom: 1rem; }
    .clinical-navigation { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .foundation-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
    .clinical-navigation { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .clinical-header, .patient-context-banner { align-items: flex-start; flex-direction: column; }
    .context-permissions { max-width: 100%; text-align: left; }
    .context-permissions ul { justify-content: flex-start; }
}

@media (max-width: 420px) {
    .clinical-navigation { grid-template-columns: 1fr; }
}

/* UI-2 Patient Overview */
.patient-overview-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 2rem; }
.patient-overview-heading h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.15rem); letter-spacing: -.045em; }
.patient-overview-heading > div:first-child > p:last-child { max-width: 44rem; margin: .75rem 0 0; color: var(--muted); line-height: 1.6; }
.access-assurance { display: grid; grid-template-columns: auto 1fr; column-gap: .65rem; align-items: center; min-width: 14rem; padding: .8rem 1rem; border: 1px solid #bddbd1; border-radius: .9rem; background: #edf8f3; }
.access-assurance > span { grid-row: 1 / 3; width: .65rem; height: .65rem; border-radius: 50%; background: #15916e; box-shadow: 0 0 0 .3rem #d8f1e7; }
.access-assurance strong { font-size: .78rem; }
.access-assurance small { color: var(--muted); font-size: .68rem; }
.patient-overview-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
.overview-section, .model-metadata { padding: 1.5rem; border: 1px solid var(--line); border-radius: 1rem; background: white; box-shadow: 0 8px 28px rgba(23, 56, 51, .04); }
.section-kicker { margin: 0 0 .55rem; color: var(--brand); font-size: .68rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.overview-section h3, .model-metadata h3 { margin: 0 0 1.25rem; font-size: 1.15rem; }
.overview-list, .metadata-grid { margin: 0; }
.overview-list > div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-top: 1px solid #edf0ed; }
.overview-list dt, .metadata-grid dt { color: var(--muted); font-size: .78rem; }
.overview-list dd, .metadata-grid dd { margin: 0; font-size: .85rem; font-weight: 700; overflow-wrap: anywhere; }
.status-badge, .read-only-badge { display: inline-flex; padding: .3rem .55rem; border-radius: 999px; color: var(--brand-deep); background: var(--accent); font-size: .68rem; font-weight: 800; }
.permission-list { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.permission-list li { padding: .45rem .65rem; border: 1px solid #c8ded7; border-radius: .65rem; color: var(--brand-deep); background: #f7fbf9; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .7rem; }
.model-metadata { margin-top: 1rem; }
.model-metadata-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.metadata-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.metadata-grid > div { min-width: 0; padding: .9rem; border: 1px solid #e4ebe7; border-radius: .75rem; background: #fafcfb; }
.metadata-grid dd { margin-top: .45rem; }
.metadata-hash { grid-column: span 2; }
.metadata-hash code { font-size: .7rem; font-weight: 600; word-break: break-all; }
.empty-state { margin: .75rem 0 0; padding: 1rem; border-radius: .75rem; color: var(--muted); background: #f5f7f5; line-height: 1.55; }
.future-modules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-top: 1rem; }
.future-modules article { padding: 1.1rem; border: 1px dashed #bdcbc6; border-radius: .85rem; background: rgba(255,255,255,.55); }
.future-modules span { color: var(--muted); font-size: .65rem; font-weight: 800; text-transform: uppercase; }
.future-modules h3 { margin: .6rem 0 .35rem; font-size: .95rem; }
.future-modules p { margin: 0; color: var(--muted); font-size: .75rem; }

@media (max-width: 800px) {
    .patient-overview-heading { align-items: flex-start; flex-direction: column; }
    .patient-overview-grid, .future-modules { grid-template-columns: 1fr; }
    .metadata-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
    .metadata-grid { grid-template-columns: 1fr; }
    .metadata-hash { grid-column: auto; }
}

/* UI-3 Documents */
.documents-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 2rem; }
.documents-heading h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.15rem); letter-spacing: -.045em; }
.documents-heading > div:first-child > p:last-child { max-width: 45rem; margin: .75rem 0 0; color: var(--muted); line-height: 1.6; }
.documents-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.documents-actions span { padding: .4rem .6rem; border: 1px dashed #bdcbc6; border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.7); font-size: .66rem; }
.documents-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15rem, 20rem); gap: 1rem; align-items: start; }
.document-list { display: grid; gap: .65rem; }
.document-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(12rem, auto) auto; align-items: center; gap: 1rem; padding: 1.1rem; border: 1px solid var(--line); border-radius: .9rem; background: white; box-shadow: 0 6px 20px rgba(23,56,51,.035); }
.document-type { color: var(--brand); font-size: .66rem; font-weight: 800; text-transform: uppercase; }
.document-main h3 { margin: .35rem 0; font-size: 1rem; }
.document-main p { margin: 0; color: var(--muted); font-size: .72rem; }
.document-state { display: grid; gap: .18rem; color: var(--muted); font-size: .68rem; }
.document-state strong { margin-top: .25rem; color: #126b54; }
.document-state .automatic { color: #7c5a13; }
.document-state .pending { color: #7b6f6c; }
.document-link, .back-link { color: var(--brand); font-size: .76rem; font-weight: 800; text-decoration: none; }
.document-link::after { content: " →"; }
.verification-readonly { padding: 1.25rem; border: 1px solid var(--line); border-radius: .9rem; background: white; }
.verification-readonly h3 { margin: 0 0 1rem; }
.verification-readonly ul { display: grid; gap: .65rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.verification-readonly li { display: grid; gap: .2rem; padding-bottom: .65rem; border-bottom: 1px solid #edf0ed; font-size: .75rem; }
.verification-readonly li span, .verification-readonly p, .verification-readonly small { color: var(--muted); }
.document-detail { display: grid; gap: 1rem; }
.document-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.4rem; border: 1px solid var(--line); border-radius: 1rem; background: white; }
.document-detail-header h3 { margin: 0; font-size: clamp(1.4rem, 3vw, 2rem); }
.document-metadata { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .65rem; margin: 0; }
.document-metadata > div, .document-status-grid > section, .provenance-card { padding: 1.1rem; border: 1px solid var(--line); border-radius: .85rem; background: white; }
.document-metadata dt, .compact-list dt { color: var(--muted); font-size: .7rem; }
.document-metadata dd, .compact-list dd { margin: .35rem 0 0; font-size: .8rem; font-weight: 700; overflow-wrap: anywhere; }
.document-status-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; }
.document-status-grid h4, .provenance-card h4 { margin: 0 0 .8rem; }
.compact-list { display: grid; gap: .55rem; margin: 0; }
.compact-list > div { display: flex; justify-content: space-between; gap: 1rem; padding-top: .55rem; border-top: 1px solid #edf0ed; }
.human-status { padding: .85rem; border-radius: .7rem; color: var(--muted); background: #f5f7f5; font-size: .78rem; font-weight: 750; }
.human-status.is-verified { color: #126b54; background: #e6f5ee; }
.human-status.is-automatic { color: #7c5a13; background: #fff5df; }
.documents-future { margin-top: 1.5rem; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-width: 980px) {
    .documents-layout { grid-template-columns: 1fr; }
    .document-row { grid-template-columns: minmax(0,1fr) auto; }
    .document-state { grid-column: 1 / -1; }
    .document-metadata { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 650px) {
    .documents-heading { align-items: flex-start; flex-direction: column; }
    .documents-actions { justify-content: flex-start; }
    .document-status-grid, .document-metadata { grid-template-columns: 1fr; }
}

/* UI-4 Clinical Memory */
.memory-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.25rem; }
.memory-heading h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.15rem); letter-spacing: -.045em; }
.memory-heading > div:first-child > p:last-child { max-width: 46rem; margin: .75rem 0 0; color: var(--muted); line-height: 1.6; }
.memory-boundary { display: grid; gap: .35rem; min-width: 18rem; padding: .85rem; border: 1px solid var(--line); border-radius: .85rem; background: white; }
.memory-boundary span { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .68rem; }
.memory-boundary strong { color: var(--brand-deep); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.memory-time-note { display: flex; gap: 1rem; margin-bottom: 1rem; padding: .9rem 1rem; border-left: .25rem solid #4a9b8a; border-radius: .55rem; color: var(--muted); background: #edf7f3; font-size: .75rem; line-height: 1.5; }
.memory-time-note strong { flex: 0 0 auto; color: var(--brand-deep); }
.memory-section { margin-top: 1rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: 1rem; background: white; box-shadow: 0 8px 28px rgba(23,56,51,.035); }
.memory-section > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.memory-section > header h3 { margin: 0; font-size: 1.2rem; }
.fact-kind-badge, .source-kind-badge, .projection-kind-badge { padding: .32rem .55rem; border-radius: 999px; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .65rem; font-weight: 800; }
.fact-kind-badge { color: #126b54; background: #e6f5ee; }
.source-kind-badge { color: #355e7a; background: #eaf3f8; }
.projection-kind-badge { color: #745716; background: #fff3d8; }
.memory-safe-state { padding: 1rem; border-radius: .7rem; color: var(--muted); background: #f5f7f5; line-height: 1.55; }
.memory-safe-state code { font-size: .72rem; }
.clinical-timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.clinical-timeline li { position: relative; display: grid; grid-template-columns: 10rem minmax(0,1fr); gap: 1rem; padding: 0 0 1.25rem 1.25rem; border-left: 2px solid #d5e5df; }
.clinical-timeline li::before { content: ""; position: absolute; left: -.4rem; top: .2rem; width: .65rem; height: .65rem; border: 2px solid white; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 1px #8ebdb2; }
.clinical-timeline time { color: var(--muted); font-size: .72rem; }
.clinical-timeline li > div > span { color: var(--brand); font-size: .65rem; font-weight: 800; text-transform: uppercase; }
.clinical-timeline h4 { margin: .3rem 0; font-size: .95rem; }
.clinical-timeline small { color: var(--muted); }
.provenance-line { margin: .65rem 0 0; padding-top: .65rem; border-top: 1px solid #edf0ed; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.fact-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .7rem; }
.fact-card { padding: 1rem; border: 1px solid #e2eae6; border-radius: .8rem; background: #fbfcfb; }
.fact-card-heading { display: flex; justify-content: space-between; gap: 1rem; color: var(--brand); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.fact-card-heading strong { color: var(--muted); }
.fact-value { margin: 1rem 0; font-size: 1.15rem; font-weight: 750; overflow-wrap: anywhere; }
.fact-value small { color: var(--muted); font-size: .7rem; }
.fact-card dl, .source-grid dl { display: grid; gap: .35rem; margin: 0; }
.fact-card dl > div, .source-grid dl > div { display: flex; justify-content: space-between; gap: 1rem; font-size: .7rem; }
.fact-card dt, .source-grid dt { color: var(--muted); }
.fact-card dd, .source-grid dd { margin: 0; font-weight: 700; text-align: right; }
.parameter-list { display: grid; gap: .75rem; }
.parameter-card { border: 1px solid #e2eae6; border-radius: .8rem; overflow: hidden; }
.parameter-card > header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1rem; background: #f4f8f6; }
.parameter-card header span { color: var(--muted); font-size: .65rem; text-transform: uppercase; }
.parameter-card h4 { margin: .2rem 0 0; }
.parameter-points { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .5rem; padding: .75rem; }
.parameter-points > div { display: grid; gap: .3rem; padding: .8rem; border: 1px solid #edf0ed; border-radius: .65rem; }
.parameter-points time, .parameter-points small, .parameter-points span { color: var(--muted); font-size: .65rem; }
.parameter-points strong { font-size: .9rem; }
.source-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .65rem; }
.source-grid article { padding: 1rem; border: 1px solid #e2eae6; border-radius: .75rem; background: #fafcfb; }
.source-grid article > span { color: #355e7a; font-size: .65rem; font-weight: 800; text-transform: uppercase; }
.source-grid h4 { margin: .55rem 0 1rem; font-size: .9rem; }
.projection-section { border-color: #e7d9b9; background: #fffdf8; }
.projection-list { display: grid; gap: .5rem; }
.projection-list article { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 1rem; padding: .75rem; border: 1px solid #eee4cf; border-radius: .65rem; background: white; font-size: .72rem; }
.projection-list span, .projection-list time { color: var(--muted); }
.analysis-boundary { margin-top: 1rem; padding: 1rem; border: 1px dashed #c5bbb0; border-radius: .7rem; }
.analysis-boundary p { margin: .4rem 0 0; color: var(--muted); font-size: .75rem; line-height: 1.55; }

@media (max-width: 900px) {
    .memory-heading { align-items: flex-start; flex-direction: column; }
    .memory-boundary { width: 100%; }
    .fact-grid, .source-grid { grid-template-columns: 1fr; }
    .parameter-points { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 650px) {
    .memory-time-note { flex-direction: column; }
    .clinical-timeline li { grid-template-columns: 1fr; }
    .parameter-points { grid-template-columns: 1fr; }
    .projection-list article { grid-template-columns: 1fr; }
}

/* UI-5 Clinical Intelligence */
.intelligence-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.25rem; }
.intelligence-heading h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.15rem); letter-spacing: -.045em; }
.intelligence-heading > div:first-child > p:last-child { max-width: 46rem; margin: .75rem 0 0; color: var(--muted); line-height: 1.6; }
.intelligence-boundary { display: grid; gap: .3rem; min-width: 20rem; padding: 1rem; border: 1px solid #dfcfad; border-radius: .9rem; background: #fffbf2; }
.intelligence-boundary strong { color: #76550d; }
.intelligence-boundary span { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .72rem; font-weight: 800; }
.intelligence-boundary small { color: var(--muted); line-height: 1.45; }
.derived-badge { display: inline-flex; padding: .32rem .55rem; border-radius: 999px; color: #76550d; background: #fff0cc; font-size: .66rem; font-weight: 850; text-transform: uppercase; }
.intelligence-safe-state { padding: 1.2rem; border: 1px solid var(--line); border-radius: .85rem; color: var(--muted); background: white; }
.intelligence-safe-state strong { color: var(--text); }
.intelligence-safe-state p { margin: .45rem 0 0; line-height: 1.55; }
.intelligence-safe-state a { display: inline-block; margin-top: .8rem; color: var(--brand); font-weight: 750; text-decoration: none; }
.analysis-list { display: grid; gap: .75rem; }
.analysis-list > article { display: grid; grid-template-columns: minmax(12rem, .8fr) minmax(18rem, 1.4fr) auto; align-items: center; gap: 1.25rem; padding: 1.15rem; border: 1px solid var(--line); border-radius: .9rem; background: white; box-shadow: 0 6px 20px rgba(23,56,51,.035); }
.analysis-list h3 { margin: .6rem 0 .3rem; font-size: 1rem; }
.analysis-list p { margin: 0; color: var(--muted); font-size: .7rem; }
.analysis-list dl { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .5rem; margin: 0; }
.analysis-list dl > div { padding: .55rem; border-radius: .55rem; background: #f7f9f7; }
.analysis-list dt { color: var(--muted); font-size: .64rem; }
.analysis-list dd { margin: .3rem 0 0; font-size: .72rem; font-weight: 750; overflow-wrap: anywhere; }
.analysis-list a, .analysis-detail > header a { color: var(--brand); font-size: .74rem; font-weight: 800; text-decoration: none; }
.intelligence-future { display: grid; gap: .35rem; margin-top: 1rem; padding: 1rem; border: 1px dashed #c5bbb0; border-radius: .8rem; background: rgba(255,255,255,.6); }
.intelligence-future span { color: var(--warning); font-size: .65rem; font-weight: 850; text-transform: uppercase; }
.intelligence-future p { margin: 0; color: var(--muted); font-size: .72rem; }
.analysis-detail { display: grid; gap: 1rem; }
.analysis-detail > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.2rem; border: 1px solid var(--line); border-radius: .9rem; background: white; }
.analysis-detail > header h3 { margin: .65rem 0 .3rem; }
.analysis-detail > header p { margin: 0; color: var(--muted); font-size: .72rem; }
.analysis-assurance { display: flex; flex-wrap: wrap; gap: .55rem 1.2rem; padding: .9rem 1rem; border-left: .25rem solid #c18a17; border-radius: .55rem; color: #69562e; background: #fff6e2; font-size: .72rem; }
.analysis-metadata-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .7rem; }
.analysis-metadata-grid > section, .structured-output, .analysis-related { padding: 1.1rem; border: 1px solid var(--line); border-radius: .85rem; background: white; }
.analysis-metadata-grid h4, .structured-output h4, .analysis-related h4 { margin: 0 0 .85rem; }
.analysis-metadata-grid dl { display: grid; gap: .45rem; margin: 0; }
.analysis-metadata-grid dl > div { display: flex; justify-content: space-between; gap: 1rem; padding-top: .45rem; border-top: 1px solid #edf0ed; font-size: .7rem; }
.analysis-metadata-grid dt { color: var(--muted); }
.analysis-metadata-grid dd { margin: 0; font-weight: 750; text-align: right; overflow-wrap: anywhere; }
.restricted-note, .derived-disclaimer { margin: .8rem 0 0; color: var(--muted); font-size: .68rem; line-height: 1.5; }
.structured-output pre { max-height: 24rem; margin: 0; padding: 1rem; overflow: auto; border-radius: .65rem; color: #24413d; background: #f4f7f5; font: .72rem/1.55 ui-monospace, "SFMono-Regular", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.analysis-related > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .8rem; }
.evidence-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .6rem; }
.evidence-grid article { padding: .85rem; border: 1px solid #e4ebe7; border-radius: .7rem; background: #fafcfb; }
.evidence-grid span { color: var(--brand); font-size: .64rem; font-weight: 850; text-transform: uppercase; }
.evidence-grid h5 { margin: .55rem 0 .35rem; font-size: .82rem; }
.evidence-grid p { margin: 0; color: var(--muted); font-size: .68rem; }
.review-list { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.review-list li { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: .8rem; padding: .75rem; border: 1px solid #e4ebe7; border-radius: .65rem; font-size: .7rem; }
.review-list li > span { padding: .25rem .45rem; border-radius: 999px; color: #76550d; background: #fff0cc; font-weight: 800; }
.review-list time, .review-list small { color: var(--muted); }

@media (max-width: 980px) {
    .intelligence-heading { align-items: flex-start; flex-direction: column; }
    .intelligence-boundary { width: 100%; }
    .analysis-list > article { grid-template-columns: 1fr; }
    .evidence-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .analysis-metadata-grid { grid-template-columns: 1fr; }
    .review-list li { grid-template-columns: 1fr; }
}
