:root {
    --ink: #1e2721;
    --muted: #6c746d;
    --paper: #f5f1e8;
    --surface: #fffdf7;
    --line: #ded8ca;
    --green: #17382c;
    --green-2: #285845;
    --gold: #bd8d3e;
    --gold-soft: #f1e4c8;
    --red: #91473f;
    --red-soft: #f7e5e1;
    --shadow: 0 16px 48px rgba(40, 48, 40, .08);
    font-family: Inter, Aptos, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper);
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; margin: 0; }
body { background: var(--paper); }
a { color: var(--green-2); text-decoration: none; }
a:hover { color: var(--gold); }
button, input, select, textarea { font: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; letter-spacing: -.02em; }
h1 { margin-bottom: .55rem; font-size: clamp(2rem, 4vw, 3.35rem); line-height: 1.03; }
h2 { margin-bottom: .7rem; font-size: 1.45rem; }
small { color: var(--muted); }

.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 1rem; background: var(--green); color: #fff; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 2rem 1.25rem; background: var(--green); color: white; display: flex; flex-direction: column; }
.workspace { min-width: 0; }
.topbar { height: 78px; padding: 0 3rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(245, 241, 232, .92); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 5; }
.topbar strong { display: block; font-family: Georgia, serif; font-size: 1.08rem; }
.content { max-width: 1500px; margin: 0 auto; padding: 3rem; }

.brand { display: flex; gap: .8rem; align-items: center; padding: 0 .55rem 2.2rem; border-bottom: 1px solid rgba(255,255,255,.13); }
.brand-mark { width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; display: grid; place-items: center; color: #fff; font: 600 1.5rem Georgia, serif; background: rgba(255,255,255,.06); }
.brand-mark.large { width: 72px; height: 72px; font-size: 2.4rem; }
.brand strong, .brand small { display: block; }
.brand strong { font: 600 1.25rem Georgia, serif; }
.brand small { color: rgba(255,255,255,.62); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; }
.nav-stack { display: grid; gap: .18rem; margin-top: 1.5rem; }
.nav-stack a { display: flex; align-items: center; gap: .8rem; padding: .65rem .85rem; border-radius: 8px; color: rgba(255,255,255,.72); font-size: .9rem; }
.nav-stack a span { width: 1.3rem; color: rgba(255,255,255,.45); text-align: center; }
.nav-stack a:hover, .nav-stack a.active { color: white; background: rgba(255,255,255,.1); }
.nav-stack a.active { box-shadow: inset 3px 0 var(--gold); }
.sidebar-foot { margin-top: auto; padding: 1.25rem .85rem 0; border-top: 1px solid rgba(255,255,255,.13); }
.sidebar-foot span, .sidebar-foot strong { display: block; }
.sidebar-foot span { color: rgba(255,255,255,.55); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; }
.sidebar-foot strong { margin: .35rem 0 1rem; font: 500 1rem Georgia, serif; }
.sidebar-intro { margin: 2rem .6rem; color: rgba(255,255,255,.65); line-height: 1.7; }
.text-button { padding: 0; border: 0; background: none; color: rgba(255,255,255,.72); cursor: pointer; }
.text-button:hover { color: white; }

.eyebrow { display: block; margin-bottom: .45rem; color: var(--gold); font-size: .69rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 2.2rem; }
.page-heading p { max-width: 760px; margin-bottom: 0; color: var(--muted); font-size: 1rem; line-height: 1.6; }
.heading-actions { display: flex; align-items: center; gap: .75rem; }
.session-chip { display: flex; align-items: center; gap: .55rem; padding: .5rem .8rem; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--muted); font-size: .78rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #56a174; box-shadow: 0 0 0 4px #dcecdf; }

.button { display: inline-flex; justify-content: center; align-items: center; padding: .72rem 1rem; border: 1px solid var(--green); border-radius: 7px; cursor: pointer; font-weight: 650; transition: .15s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: var(--green); }
.button.primary:hover { color: white; background: var(--green-2); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button.wide { width: 100%; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; font-size: 1.3rem; }
.text-action { padding: 0; border: 0; color: var(--green-2); background: transparent; cursor: pointer; font-weight: 700; }
.button-row { display: flex; flex-wrap: wrap; gap: .6rem; }

.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.metric { min-height: 145px; padding: 1.2rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); display: flex; flex-direction: column; }
.metric span, .metric small { color: var(--muted); }
.metric span { font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.metric strong { margin: auto 0 .15rem; font: 500 2.5rem Georgia, serif; }
.metric.accent { background: var(--green); border-color: var(--green); color: white; }
.metric.accent span, .metric.accent small { color: rgba(255,255,255,.68); }
.metric.warning { background: var(--gold-soft); border-color: #dfc391; }

.two-column { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); gap: 1.5rem; }
.panel, .table-card { padding: 1.5rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.panel + .panel, .panel + .table-card { margin-top: 1.5rem; }
.spaced-section { margin-top: 1.5rem; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.panel-heading h2 { margin: 0; }
.research-principle { background: #ece8dc; }
.research-principle > p { color: var(--muted); line-height: 1.6; }
.principle-step { display: flex; gap: .8rem; align-items: flex-start; padding: .8rem 0; border-top: 1px solid rgba(30,39,33,.1); }
.principle-step b { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: white; font-size: .78rem; }
.principle-step strong, .principle-step span { display: block; }
.principle-step span { color: var(--muted); font-size: .85rem; line-height: 1.5; }
.activity-row { display: grid; grid-template-columns: 95px 1fr; gap: 1rem; padding: .9rem 0; border-top: 1px solid var(--line); }
.activity-row > span { color: var(--muted); font-size: .77rem; }
.activity-row strong, .activity-row small { display: block; overflow-wrap: anywhere; }

.form-panel { margin-bottom: 1.5rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.1rem; }
.form-grid label, .login-card label { display: grid; gap: .4rem; color: var(--muted); font-size: .78rem; font-weight: 650; }
.form-grid .span-2 { grid-column: span 2; }
.compact-form { display: grid; gap: .8rem; margin-bottom: 1.2rem; padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: #faf8f1; }
.compact-form label { display: grid; gap: .35rem; color: var(--muted); font-size: .75rem; font-weight: 650; }
input:not([type="checkbox"]):not([type="range"]), select, textarea { width: 100%; padding: .72rem .8rem; border: 1px solid #cbc4b6; border-radius: 6px; color: var(--ink); background: white; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(189,141,62,.14); }
textarea { min-height: 100px; resize: vertical; }
input[type="range"] { width: 100%; accent-color: var(--green); }
.check-label { display: flex !important; grid-auto-flow: column; justify-content: start; align-items: center; gap: .55rem !important; }
.selected-file { color: var(--muted); }
.validation-message { color: var(--red); font-size: .76rem; }
.alert { margin: .8rem 0; padding: .8rem 1rem; border-radius: 6px; }
.alert.error { color: #762f2a; background: var(--red-soft); border: 1px solid #e8bbb5; }
.alert.success { color: #245b3b; background: #e3f1e7; border: 1px solid #bad8c3; }

.table-card { padding: 0; overflow: auto; box-shadow: none; }
table { width: 100%; border-collapse: collapse; }
th { padding: .85rem 1rem; color: var(--muted); background: #eee9de; font-size: .68rem; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: 1rem; border-top: 1px solid var(--line); vertical-align: top; font-size: .88rem; }
td strong, td small { display: block; }
td small { margin-top: .25rem; }
tr:hover td { background: #fbf8f1; }
.badge { display: inline-flex; align-items: center; width: max-content; padding: .28rem .5rem; border-radius: 99px; background: #e8e8e3; color: #59605a; font-size: .65rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.badge.proven, .badge.probable { background: #dbeadf; color: #275c3c; }
.badge.possible, .badge.warning, .badge.high { background: var(--gold-soft); color: #76541f; }
.badge.unsupported, .badge.disproven, .badge.critical { background: var(--red-soft); color: #7c3731; }
.badge.normal, .badge.neutral, .badge.low { background: #e7e7e1; color: #5f655f; }

.loading, .empty-state { padding: 2rem; border: 1px dashed #c7bfae; border-radius: 9px; color: var(--muted); text-align: center; background: rgba(255,255,255,.35); }
.empty-state.compact { padding: 1rem; }
.filter-row, .search-bar { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.3rem; }
.filter-row > input, .search-bar > input { flex: 1; }
.record-count { min-width: max-content; color: var(--muted); font-size: .78rem; }
.search-bar { padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.result-list, .claim-list, .evidence-list { display: grid; gap: .8rem; }
.result-card { display: grid; grid-template-columns: 100px 1fr; align-items: start; gap: .3rem 1rem; padding: 1.1rem; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); }
.result-card:hover { border-color: var(--gold); box-shadow: var(--shadow); color: var(--ink); }
.result-card p { grid-column: 2; margin: 0; color: var(--muted); font-size: .86rem; }

.evidence-card { display: flex; gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.file-icon { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; color: var(--green); background: #e2e8e1; font-size: 1.2rem; }
.evidence-main { min-width: 0; flex: 1; }
.evidence-title { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; font-weight: 700; }
.evidence-title a, .evidence-main p { overflow-wrap: anywhere; }
.evidence-main p { margin: .3rem 0; color: var(--muted); font-size: .8rem; }
.evidence-main code { display: block; margin-top: .55rem; overflow: hidden; color: #777; font-size: .65rem; text-overflow: ellipsis; }
.evidence-main .text-action { display: inline-block; margin-top: .65rem; font-size: .72rem; }
.evidence-card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; margin-top: .75rem; }
.evidence-card-actions .text-action { margin-top: 0; }
.evidence-card-actions .button { padding: .45rem .7rem; font-size: .7rem; }
.evidence-detail-heading > div:first-child { min-width: 0; flex: 1; }
.evidence-detail-heading h1 { max-width: 100%; overflow-wrap: anywhere; font-size: clamp(1.85rem, 3.25vw, 3.35rem); }
.evidence-detail-heading .heading-actions { flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; }
.evidence-workbench-grid > .panel { min-width: 0; }
.evidence-workbench-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 1.5rem; align-items: start; }
.evidence-workbench-grid .panel + .panel { margin-top: 0; }
.evidence-preview-panel { min-width: 0; }
.evidence-viewer-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.evidence-viewer-heading h2 { margin-bottom: 0; }
.viewer-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.viewer-actions .button { padding: .45rem .7rem; font-size: .7rem; }
.evidence-preview-image { display: block; width: 100%; max-height: 720px; object-fit: contain; border: 1px solid var(--line); border-radius: 7px; background: #f0ede5; }
.evidence-preview-frame { width: 100%; min-height: 680px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.evidence-media-player { display: block; width: 100%; margin-top: 1rem; }
.evidence-video-player { display: block; width: 100%; max-height: 720px; border: 1px solid var(--line); border-radius: 7px; background: #111; }
.viewer-note { margin-bottom: .75rem; padding: .75rem 1rem; border-left: 3px solid var(--gold); color: var(--muted); background: var(--gold-soft); font-size: .76rem; line-height: 1.5; }
.viewer-fallback { margin: .65rem 0 0; color: var(--muted); font-size: .74rem; }
.evidence-reader { max-height: 680px; margin: 0; overflow: auto; padding: 1.25rem; border: 1px solid var(--line); border-radius: 7px; white-space: pre-wrap; overflow-wrap: anywhere; background: #fffdf8; color: var(--ink); font: .88rem/1.7 Georgia, serif; }
.evidence-unavailable p { margin: .5rem 0 1rem; }
.evidence-unavailable .button-row { justify-content: center; }
.evidence-preview-panel.viewer-expanded { position: fixed; inset: 1rem; z-index: 1100; display: flex; flex-direction: column; margin: 0 !important; padding: 1.25rem; overflow: hidden; box-shadow: 0 18px 70px rgba(0,0,0,.35); }
.viewer-expanded .evidence-preview-image { flex: 1; min-height: 0; max-height: calc(100vh - 8rem); }
.viewer-expanded .evidence-preview-frame { flex: 1; min-height: 0; height: calc(100vh - 8rem); }
.viewer-expanded .evidence-reader { flex: 1; min-height: 0; max-height: none; }
.viewer-expanded .evidence-video-player { flex: 1; min-height: 0; max-height: calc(100vh - 8rem); }
.evidence-workbench-grid .detail-list { grid-template-columns: minmax(0, 120px) minmax(0, 1fr); }
.evidence-workbench-grid .detail-list dd { min-width: 0; overflow-wrap: anywhere; }
.state-badges { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .4rem; }
.hash-wrap { display: block; max-width: 100%; overflow-wrap: anywhere; word-break: break-all; font-size: .7rem; }
.extracted-text { max-height: 560px; overflow: auto; padding: 1.2rem; border: 1px solid var(--line); border-radius: 7px; white-space: pre-wrap; background: #faf8f1; font: .84rem/1.65 Consolas, monospace; }

.claim-card { padding: 1.3rem 1.5rem; border-left: 4px solid var(--green-2); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.claim-card.rejected { border-left-color: var(--red); background: #fffaf8; }
.claim-card h2 { margin: .8rem 0 .5rem; font-size: 1.25rem; }
.claim-card p { color: var(--muted); line-height: 1.6; }
.claim-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; color: var(--muted); font-size: .72rem; }
.subject-link { font-size: .78rem; font-weight: 700; }
.claim-row { display: grid; grid-template-columns: 100px 1fr; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.claim-row p { margin: .3rem 0; color: var(--muted); }

.detail-list { display: grid; grid-template-columns: 120px 1fr; margin: 1.2rem 0 0; }
.detail-list dt, .detail-list dd { padding: .65rem 0; border-top: 1px solid var(--line); }
.detail-list dt { color: var(--muted); font-size: .74rem; text-transform: uppercase; }
.detail-list dd { margin: 0; }
.record-link { display: grid; gap: .3rem; margin: 1rem 0 1.5rem; padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: #faf8f1; }
.record-link strong, .record-link small { display: block; }
.block-title { display: block; margin-top: .2rem; }
.short-hash { display: block; max-width: 240px; overflow: hidden; color: var(--muted); font-size: .68rem; text-overflow: ellipsis; }
.lead { color: var(--muted); font: 1.05rem/1.7 Georgia, serif; }
.fact-row { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.fact-row strong, .fact-row small { display: block; }
.fact-row p { max-width: 680px; margin: .35rem 0 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }

details { margin-top: 1rem; color: var(--muted); }
summary { color: var(--green-2); cursor: pointer; font-size: .78rem; font-weight: 700; }
.pre-line { white-space: pre-line; line-height: 1.65; }
.muted-line { margin: 0 0 .55rem; color: var(--muted); }
.linked-people { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin: 0 0 .7rem; font-size: .78rem; }

.timeline-list { display: grid; gap: .8rem; }
.timeline-card { display: grid; grid-template-columns: 150px 1fr; gap: 1.4rem; padding: 1.3rem 1.5rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.timeline-date { display: flex; flex-direction: column; gap: .35rem; color: var(--green); }
.timeline-date strong { font: 500 1.05rem Georgia, serif; }
.timeline-date span { color: var(--gold); font-size: .7rem; font-weight: 800; letter-spacing: .08em; }
.timeline-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.timeline-title h2 { margin: 0 0 .35rem; font-size: 1.15rem; }

.source-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.source-card { padding: 1.3rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.source-card h2 { margin: .8rem 0 1rem; font-size: 1.15rem; }
.source-heading { display: flex; justify-content: space-between; gap: 1rem; color: var(--gold); font-size: .72rem; font-weight: 800; letter-spacing: .06em; }
.compact-list { display: grid; grid-template-columns: 95px 1fr; margin: 0; }
.compact-list dt, .compact-list dd { padding: .45rem 0; border-top: 1px solid var(--line); }
.compact-list dt { color: var(--muted); font-size: .68rem; text-transform: uppercase; }
.compact-list dd { margin: 0; overflow-wrap: anywhere; font-size: .8rem; }

.kanban { display: grid; grid-template-columns: repeat(5, minmax(230px, 1fr)); gap: 1rem; overflow-x: auto; padding-bottom: .7rem; }
.kanban-column { min-height: 300px; padding: .8rem; border-radius: 9px; background: #eae6dc; }
.kanban-heading { display: flex; justify-content: space-between; align-items: center; padding: .4rem .3rem .8rem; }
.kanban-heading h2 { margin: 0; font: 700 .75rem Inter, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.kanban-heading span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: rgba(0,0,0,.07); font-size: .72rem; }
.task-card { margin-bottom: .7rem; padding: 1rem; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.task-card > div:first-child { display: flex; justify-content: space-between; gap: .5rem; }
.task-card h3 { margin: .85rem 0 .45rem; font: 600 .95rem Georgia, serif; }
.task-card p { color: var(--muted); font-size: .78rem; line-height: 1.5; }
.due { margin-top: .7rem; color: var(--red); font-size: .7rem; font-weight: 700; }

.evidence-trail-row { display: grid; grid-template-columns: 105px minmax(0, 1fr) auto; align-items: start; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.evidence-trail-row strong, .evidence-trail-row small { display: block; overflow-wrap: anywhere; }
.evidence-trail-row p { margin: .55rem 0 0; color: var(--muted); line-height: 1.55; }
.evidence-link-form { grid-template-columns: minmax(220px, .7fr) minmax(280px, 1.3fr); }

.research-log-grid { align-items: start; }
.log-entry { padding: 1rem 0; border-top: 1px solid var(--line); }
.log-entry:first-of-type { border-top: 0; }
.log-entry-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.log-entry-heading strong, .log-entry-heading small { display: block; }
.log-entry h3 { margin: .8rem 0 .35rem; font: 600 1rem Georgia, serif; line-height: 1.4; }
.log-entry > p { margin: .55rem 0 0; color: var(--muted); line-height: 1.55; }
.request-facts { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: .55rem; }

.pedigree-toolbar { display: grid; grid-template-columns: minmax(210px, .7fr) minmax(250px, 1fr) minmax(210px, .72fr) minmax(145px, .45fr) auto; align-items: end; gap: 1rem; margin-bottom: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.pedigree-toolbar label { display: grid; gap: .4rem; color: var(--muted); font-size: .74rem; font-weight: 700; }
.pedigree-totals { display: grid; grid-template-columns: repeat(3, auto auto); align-items: baseline; justify-content: end; gap: .15rem .35rem; padding: .55rem .2rem; white-space: nowrap; }
.pedigree-totals strong { color: var(--green); font: 600 1.15rem Georgia, serif; }
.pedigree-totals span { margin-right: .65rem; color: var(--muted); font-size: .67rem; text-transform: uppercase; letter-spacing: .06em; }
.pedigree-legend { display: flex; flex-wrap: wrap; gap: .7rem 1.4rem; margin: 0 0 1.3rem; padding: .75rem 1rem; border-radius: 8px; color: var(--muted); background: #ebe6da; font-size: .72rem; }
.pedigree-legend span { display: inline-flex; align-items: center; gap: .5rem; }
.legend-line { position: relative; width: 34px; height: 8px; display: inline-block; border-top: 2px solid var(--green); }
.legend-line.spouse { border-top-width: 5px; border-bottom: 1px solid var(--green); }
.legend-line.extended { border-top-style: dashed; border-top-color: var(--gold); }
.legend-card { width: 21px; height: 14px; display: inline-block; border: 1px solid #a86c2c; border-radius: 3px; background: #fffaf0; }
.pedigree-inspector { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .55fr) auto; gap: 1.2rem; align-items: start; margin-bottom: 1.3rem; padding: 1.25rem 1.4rem; border: 1px solid #c5a262; border-left: 5px solid var(--gold); border-radius: 9px; background: #fff8e8; box-shadow: var(--shadow); }
.pedigree-inspector h2 { margin-bottom: .45rem; font-size: 1.25rem; }
.pedigree-inspector p { margin-bottom: 0; color: var(--muted); line-height: 1.55; }
.pedigree-inspector dl { display: grid; gap: .7rem; margin: 0; }
.pedigree-inspector dl div { display: grid; gap: .15rem; }
.pedigree-inspector dt { color: var(--muted); font-size: .66rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.pedigree-inspector dd { margin: 0; font-size: .82rem; }
.pedigree-citations { display: grid; gap: .45rem; margin-top: 1rem; padding-top: .85rem; border-top: 1px solid #ddcda9; }
.pedigree-citations > strong { color: var(--green); font-size: .76rem; }
.pedigree-citations > span { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .35rem .55rem; }
.pedigree-citations > span small { grid-column: 2; }
.pedigree-citations .badge { font-style: normal; }
.pedigree-report { padding: 2rem; border: 1px solid var(--line); border-radius: 10px; background: #f7f1e4; box-shadow: var(--shadow); }
.print-heading { display: none; }
.pedigree-family { margin-bottom: 2rem; overflow: hidden; border: 1px solid #d5c8ad; border-radius: 12px; background: #fffdf8; }
.pedigree-family > header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding: 1.3rem 1.5rem 1rem; border-bottom: 1px solid #e1d6c2; background: linear-gradient(115deg, #f3ead8, #fffdf8 65%); }
.pedigree-family > header h2 { margin-bottom: 0; color: var(--green); font-size: 1.75rem; }
.pedigree-family > header small { white-space: nowrap; }
.pedigree-family-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .45rem .8rem; }
.pedigree-family.collapsed > header { border-bottom: 0; }
.pedigree-scroll { max-width: 100%; overflow: auto; padding: 1rem; background-color: #f9f5eb; background-image: linear-gradient(rgba(23,56,44,.03) 1px, transparent 1px), linear-gradient(90deg, rgba(23,56,44,.03) 1px, transparent 1px); background-size: 28px 28px; scrollbar-color: #b9aa8f #eee6d7; }
.pedigree-scroll:focus-visible { outline: 3px solid rgba(189,141,62,.45); outline-offset: -3px; }
.pedigree-surface { position: relative; min-width: 700px; margin: 0 auto; }
.pedigree-generation-band { position: absolute; z-index: 0; left: 0; right: 0; height: 1px; border-top: 1px solid rgba(126,105,70,.2); pointer-events: none; }
.pedigree-generation-band span { position: absolute; top: -8px; left: 8px; padding: 0 .4rem; color: #87785f; background: #f9f5eb; font: 700 .55rem/1.1 Inter, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.pedigree-connectors { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pedigree-connector { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.pedigree-connector.spouse { stroke-width: 7; }
.pedigree-connector.spouse-inner { stroke: #f9f5eb; stroke-width: 2.5; }
.pedigree-connector.grandparent, .pedigree-connector.extended { stroke: var(--gold); stroke-dasharray: 8 6; }
.pedigree-connector.probable { stroke: #a86c2c; stroke-dasharray: 7 5; }
.pedigree-connector-hit { fill: none; stroke: transparent; stroke-width: 20; cursor: pointer; pointer-events: stroke; }
.pedigree-link-label { cursor: pointer; }
.pedigree-link-label rect { fill: #fffdf8; stroke: #bcae92; stroke-width: 1; }
.pedigree-link-label text { fill: var(--muted); font: 650 9px Inter, sans-serif; text-transform: uppercase; }
.pedigree-person { position: absolute; z-index: 1; width: 220px; height: 172px; display: flex; align-items: flex-start; gap: .8rem; padding: 1rem; border: 1px solid var(--green); border-radius: 12px; color: var(--ink); background: linear-gradient(145deg, #fffefb, #f3eddf); box-shadow: 0 8px 20px rgba(34,47,38,.12); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.pedigree-person:hover, .pedigree-person:focus-visible { z-index: 3; transform: translateY(-3px); border-color: var(--gold); color: var(--ink); box-shadow: 0 14px 28px rgba(34,47,38,.18); outline: none; }
.pedigree-person.probable { border-color: #a86c2c; background: linear-gradient(145deg, #fffefb, #fff3dd); }
.pedigree-person.focused { outline: 4px solid rgba(189,141,62,.28); outline-offset: 4px; }
.pedigree-portrait { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #bdad90; border-radius: 50%; color: #fff; background: var(--green); font: 650 .85rem Georgia, serif; letter-spacing: .04em; }
.pedigree-portrait.has-image { overflow: hidden; background: #ded5c3; }
.pedigree-portrait img { width: 100%; height: 100%; object-fit: cover; }
.pedigree-person-copy { min-width: 0; display: flex; flex-direction: column; height: 100%; }
.pedigree-person-copy > small { color: var(--gold); font-size: .62rem; font-weight: 800; letter-spacing: .08em; }
.pedigree-person-copy > strong { margin: .28rem 0 .2rem; overflow: hidden; font: 600 1rem/1.1 Georgia, serif; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pedigree-person-copy > span { color: var(--muted); font-size: .7rem; }
.pedigree-record-signals { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .45rem; }
.pedigree-record-signals i { padding: .16rem .28rem; border: 1px solid #d6c8ae; border-radius: 4px; color: #4f6258; background: rgba(255,255,255,.62); font-size: .54rem; font-style: normal; font-weight: 750; }
.pedigree-person-copy > em { margin-top: auto; color: var(--muted); font-size: .6rem; font-style: normal; }
.pedigree-person-copy > b { margin-top: .28rem; color: var(--green-2); font-size: .64rem; }
.pedigree-link-register { display: flex; gap: .55rem; overflow-x: auto; padding: .9rem 1rem 1rem; border-top: 1px solid #e1d6c2; background: #f2eadb; }
.pedigree-link-register button { min-width: 175px; display: grid; gap: .15rem; padding: .65rem .75rem; border: 1px solid #cfc0a4; border-radius: 7px; color: var(--ink); background: #fffdf8; text-align: left; cursor: pointer; }
.pedigree-link-register button:hover, .pedigree-link-register button.active { border-color: var(--gold); box-shadow: 0 4px 12px rgba(40,48,40,.09); }
.pedigree-link-register strong { color: var(--gold); font-size: .62rem; letter-spacing: .07em; }
.pedigree-link-register span { overflow: hidden; font-size: .7rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.pedigree-link-register small { font-size: .6rem; }
.relationship-evidence-card { border-top: 1px solid var(--line); }
.relationship-evidence-card:first-of-type { border-top: 0; }
.relationship-evidence-card .fact-row { align-items: flex-start; border-top: 0; }
.relationship-evidence-card .fact-row > div { min-width: 0; }
.relationship-evidence-card .fact-row > .badge { flex: 0 0 auto; align-self: flex-start; justify-content: center; white-space: nowrap; }
.relationship-citations { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .75rem; padding: 0 0 .8rem; }
.relationship-citation { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .4rem; padding: .35rem .5rem; border-radius: 6px; background: var(--gold-soft); }
.identity-profile { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 1.2rem; }
.identity-portrait { width: 112px; height: 138px; overflow: hidden; display: block; border: 1px solid #c7b898; border-radius: 9px; background: #eee7d9; box-shadow: 0 8px 18px rgba(34,47,38,.14); }
.identity-portrait img { width: 100%; height: 100%; object-fit: cover; }

.review-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.review-total { display: grid; gap: .2rem; padding: 1rem; border: 1px solid #d6ba7d; border-radius: 9px; color: var(--ink); background: #fff8e8; text-align: left; cursor: pointer; }
.review-total strong { color: var(--gold); font: 650 1.7rem Georgia, serif; }
.review-total span { color: var(--muted); font-size: .68rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.review-total.urgent { border-color: #bc8178; background: #fff2f0; }
.review-total.urgent strong { color: #9a4034; }
.review-total.strengthening { border-color: #c8a46a; }
.review-total.evidenced { border-color: #8faf9e; background: #f0f7f3; }
.review-total.evidenced strong { color: var(--green); }
.review-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.review-toolbar label { min-width: 260px; display: grid; gap: .35rem; color: var(--muted); font-size: .72rem; font-weight: 700; }
.relationship-review-list { display: grid; gap: 1rem; }
.relationship-review-card { padding: 1.25rem 1.35rem; border: 1px solid var(--line); border-left: 5px solid var(--gold); border-radius: 10px; background: var(--surface); box-shadow: 0 6px 16px rgba(34,47,38,.07); }
.relationship-review-card.requires-assessment { border-left-color: #a54a3d; }
.relationship-review-card.needs-strengthening { border-left-color: #af742f; }
.relationship-review-card.evidenced { border-left-color: var(--green); }
.relationship-review-card > header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.relationship-review-card h2 { margin: .2rem 0 0; font-size: 1.25rem; }
.relationship-review-card h2 span { color: var(--muted); font-weight: 400; }
.review-state { flex: 0 0 auto; padding: .35rem .55rem; border-radius: 99px; color: #fff; background: var(--gold); font-size: .64rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.requires-assessment .review-state { background: #a54a3d; }
.needs-strengthening .review-state { background: #af742f; }
.evidenced .review-state { background: var(--green); }
.review-reason { margin: .8rem 0 .35rem; color: var(--green); font-weight: 700; }
.review-metrics { display: flex; flex-wrap: wrap; gap: .5rem; margin: .9rem 0; }
.review-metrics span { padding: .34rem .5rem; border-radius: 5px; color: var(--muted); background: #eee9de; font-size: .66rem; }
.review-citations { display: grid; gap: .45rem; margin-top: .8rem; padding: .8rem; border-radius: 7px; background: #f2eee4; }
.review-citations > span { display: grid; grid-template-columns: auto minmax(0,1fr); gap: .3rem .55rem; align-items: center; }
.review-citations > span small { grid-column: 2; }
.review-candidates { margin-top: .8rem; padding: .7rem .8rem; border: 1px solid #ddd0b8; border-radius: 7px; background: #fffaf0; }
.review-candidates summary { color: var(--green); font-weight: 750; cursor: pointer; }
.review-candidate { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 1rem; padding: .75rem 0; border-top: 1px solid #e4d8c1; }
.review-candidate div { display: grid; gap: .22rem; }
.review-candidate p { margin: .15rem 0 0; color: var(--muted); font-size: .72rem; }
.review-actions { margin-top: 1rem; }
.review-citation-form { margin-top: 1rem; }
.relationship-citation small { flex-basis: 100%; }
.relationship-evidence-form { container-type: inline-size; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; margin: 1rem 0 1.1rem; padding: clamp(1rem, 2.2vw, 1.35rem); border: 1px solid #c8a868; border-radius: 10px; background: #fffaf0; box-shadow: inset 0 1px 0 rgba(255,255,255,.72); }
.relationship-evidence-form-heading { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-bottom: .85rem; border-bottom: 1px solid #e3d5ba; }
.relationship-evidence-form-heading > div { min-width: 0; }
.relationship-evidence-form-heading .eyebrow { margin-bottom: .3rem; }
.relationship-evidence-form-heading .block-title { overflow-wrap: anywhere; }
.relationship-evidence-form-heading > small { flex: 0 0 auto; padding: .28rem .45rem; border-radius: 999px; color: var(--green); background: #e5eee8; font-size: .65rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.relationship-evidence-grid { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.2rem; align-items: start; }
.relationship-evidence-form .relationship-evidence-field { min-width: 0; display: grid; align-content: start; gap: .45rem; color: var(--muted); font-size: .75rem; font-weight: 650; }
.relationship-evidence-form .relationship-evidence-field > span { color: #56615a; font-size: .76rem; font-weight: 750; }
.relationship-evidence-form .relationship-evidence-field small { color: var(--muted); font-size: .68rem; font-weight: 450; line-height: 1.45; }
.relationship-evidence-form select,
.relationship-evidence-form textarea { min-width: 0; max-width: 100%; }
.relationship-evidence-form select { overflow: hidden; text-overflow: ellipsis; }
.relationship-evidence-field--full,
.relationship-evidence-field--note { grid-column: 1 / -1; }
.relationship-evidence-field--note textarea { min-height: 8.5rem; line-height: 1.55; }
.relationship-evidence-target { min-width: 0; padding: .8rem .9rem; border: 1px solid #ddd0b8; border-radius: 7px; background: rgba(255,255,255,.62); }
.relationship-evidence-target small,
.relationship-evidence-target strong { display: block; }
.relationship-evidence-target strong { margin-top: .2rem; overflow-wrap: anywhere; }
.relationship-evidence-message { margin: 0; }
.relationship-evidence-actions { align-items: center; margin: 0; padding-top: .9rem; border-top: 1px solid #e3d5ba; }
.relationship-evidence-actions .button { margin: 0; }

@container (max-width: 620px) {
    .relationship-evidence-grid { grid-template-columns: minmax(0, 1fr); }
    .relationship-evidence-form-heading { flex-direction: column; }
    .relationship-evidence-field--full, .relationship-evidence-field--note { grid-column: auto; }
}

.subsection-heading { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-size: 1.15rem; }
.tree-caveat { padding: 1rem; border-left: 3px solid var(--gold); color: var(--muted); background: var(--gold-soft); font-size: .82rem; line-height: 1.55; }

.login-wrap { min-height: calc(100vh - 150px); display: grid; grid-template-columns: 1.25fr .75fr; gap: clamp(3rem, 8vw, 8rem); align-items: center; }
.login-copy h1 { max-width: 780px; font-size: clamp(2.8rem, 5vw, 5rem); }
.login-copy p { max-width: 650px; color: var(--muted); font: 1.15rem/1.7 Georgia, serif; }
.login-card { padding: 2rem; }
.login-card label { margin-top: 1rem; }
.login-card .button { margin-top: 1.2rem; }
.privacy-note { display: block; margin-top: 1rem; line-height: 1.5; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; padding: .8rem 1rem; color: white; background: var(--red); }
#blazor-error-ui .reload { color: white; text-decoration: underline; }
#blazor-error-ui .dismiss { float: right; border: 0; color: white; background: none; cursor: pointer; }

@media (max-width: 1150px) {
    .metric-grid { grid-template-columns: repeat(3, 1fr); }
    .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
    .content, .topbar { padding-left: 2rem; padding-right: 2rem; }
}

@media (max-width: 1000px) {
    .evidence-detail-heading { align-items: flex-start; flex-direction: column; }
    .evidence-detail-heading .heading-actions { justify-content: flex-start; }
    .evidence-workbench-grid { grid-template-columns: minmax(0, 1fr); }
    .pedigree-toolbar { grid-template-columns: 1fr 1fr; }
    .pedigree-totals { grid-column: span 2; justify-content: start; }
    .review-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar { position: static; width: 100%; height: auto; padding: 1rem; }
    .brand { padding-bottom: 1rem; }
    .nav-stack { grid-template-columns: repeat(2, 1fr); margin-top: 1rem; }
    .sidebar-foot { display: none; }
    .topbar { height: 64px; padding: 0 1rem; }
    .topbar .eyebrow { display: none; }
    .content { padding: 1.5rem 1rem; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .two-column, .login-wrap, .evidence-workbench-grid { grid-template-columns: 1fr; }
    .source-grid { grid-template-columns: 1fr; }
    .timeline-card { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .filter-row, .search-bar { align-items: stretch; flex-direction: column; }
    .pedigree-toolbar { grid-template-columns: 1fr; }
    .pedigree-totals { grid-column: auto; grid-template-columns: repeat(3, auto auto); overflow-x: auto; }
    .pedigree-inspector { grid-template-columns: 1fr auto; }
    .pedigree-inspector dl { grid-column: 1; }
    .pedigree-inspector .icon-button { grid-column: 2; grid-row: 1; }
    .pedigree-report { padding: .7rem; }
    .pedigree-family > header { align-items: flex-start; flex-direction: column; }
    .pedigree-scroll { padding: .5rem; }
    .result-card { grid-template-columns: 1fr; }
    .result-card p { grid-column: 1; }
    .evidence-trail-row { grid-template-columns: 1fr; }
    .evidence-link-form { grid-template-columns: 1fr; }
    .review-summary { grid-template-columns: 1fr 1fr; }
    .review-toolbar, .relationship-review-card > header { align-items: stretch; flex-direction: column; }
    .review-toolbar label { min-width: 0; }
    .review-candidate { grid-template-columns: 1fr; }
    .identity-profile { grid-template-columns: 1fr; }
}

@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .app-shell { display: block; }
    .content { max-width: none; padding: 0; }
    @page { size: landscape; margin: 8mm; }
    .pedigree-report { border: 0; padding: 0; background: white; box-shadow: none; }
    .print-heading { display: block; margin-bottom: 2rem; border-bottom: 2px solid #222; }
    .pedigree-family { break-inside: avoid; border-color: #999; }
    .pedigree-family.print-excluded { display: none !important; }
    .pedigree-scroll { overflow: visible; padding: 0; background: white; zoom: .72; }
    .pedigree-surface { zoom: 1 !important; }
    .pedigree-link-register { display: none; }
    .pedigree-person { box-shadow: none; }
}

/* Connected source provenance graph */
.source-filter-row select { min-width: 170px; width: auto; }
.source-card-counts { display: flex; flex-wrap: wrap; gap: .35rem .8rem; margin: 1rem 0 .2rem; padding-top: .8rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .7rem; }
.source-card-counts span { white-space: nowrap; }
.source-card-counts strong { color: var(--green); font-size: .9rem; }
.source-open-link { display: inline-block; margin-top: .8rem; }
.source-summary-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 1.5rem; align-items: start; }
.source-summary-grid > .panel { margin-top: 0; }
.source-usage-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
.source-usage-grid > div { padding: .8rem; border: 1px solid var(--line); border-radius: 7px; background: #faf8f1; }
.source-usage-grid strong, .source-usage-grid span { display: block; }
.source-usage-grid strong { color: var(--green); font: 600 1.6rem Georgia, serif; }
.source-usage-grid span { margin-top: .15rem; color: var(--muted); font-size: .65rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.source-group-heading { margin-bottom: .65rem; }
.source-link-list { display: grid; gap: .55rem; }
.source-link-card { display: grid; grid-template-columns: minmax(125px, auto) minmax(0, 1fr) auto; align-items: start; gap: .8rem 1rem; padding: .9rem 0; border-top: 1px solid var(--line); }
.source-link-kind { display: flex; flex-wrap: wrap; gap: .3rem; }
.source-link-main { min-width: 0; }
.source-link-main strong, .source-link-main small { display: block; overflow-wrap: anywhere; }
.source-link-main p { margin: .35rem 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.source-chip-row { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0 .75rem; }
.source-chip { padding: .28rem .48rem; border: 1px solid #d4c6aa; border-radius: 99px; color: var(--green-2); background: #fff8e8; font-size: .65rem; font-weight: 700; }
.source-chip:hover { border-color: var(--gold); color: var(--green); }

@media (max-width: 1000px) {
    .source-summary-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .source-filter-row select { width: 100%; }
    .source-usage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .source-link-card { grid-template-columns: 1fr; }
}

/* Provenance coverage and complete source-to-evidence navigation */
.source-overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: .8rem; margin: 0 0 1.25rem; }
.source-overview-card { min-width: 0; display: grid; gap: .28rem; padding: 1rem; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); text-align: left; cursor: pointer; box-shadow: 0 4px 12px rgba(34,47,38,.04); }
.source-overview-card:hover, .source-overview-card:focus-visible, .source-overview-card.active { border-color: var(--gold); outline: none; box-shadow: 0 7px 18px rgba(34,47,38,.1); }
.source-overview-card.active { box-shadow: inset 0 0 0 1px var(--gold), 0 7px 18px rgba(34,47,38,.1); }
.source-overview-card span { color: var(--gold); font-size: .64rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.source-overview-card strong { color: var(--green); font: 600 2rem/1 Georgia, serif; }
.source-overview-card small { color: var(--muted); line-height: 1.35; }
.source-overview-card.warning { background: #fff8e8; }
.source-overview-card.alert-card { background: #f8efeb; }
.source-card-status { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .8rem; }
.source-filter-row { flex-wrap: wrap; }
.source-filter-row input { min-width: min(430px, 100%); flex: 1 1 320px; }
.source-filter-row select { flex: 0 1 auto; }
.source-audit-panel { margin-top: 1rem; }
.source-audit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; margin-top: .75rem; }
.source-audit-grid > div { min-width: 0; padding: .8rem; border: 1px solid var(--line); border-radius: 7px; background: #faf8f1; }
.source-audit-grid strong, .source-audit-grid span { display: block; }
.source-audit-grid strong { color: var(--green); font: 600 1.55rem/1 Georgia, serif; }
.source-audit-grid span { margin-top: .24rem; color: var(--muted); font-size: .69rem; line-height: 1.35; }
.source-audit-issues { margin-top: .85rem; }
.source-audit-issues > summary { color: var(--green); cursor: pointer; font-weight: 750; }
.source-audit-issues .source-link-list { margin-top: .65rem; }
.source-usage-grid > .source-usage-tile { padding: .8rem; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #faf8f1; text-align: left; cursor: pointer; }
.source-usage-grid > .source-usage-tile:hover, .source-usage-grid > .source-usage-tile:focus-visible, .source-usage-grid > .source-usage-tile.active { border-color: var(--gold); outline: none; background: #fff8e8; box-shadow: 0 4px 11px rgba(34,47,38,.08); }
.source-usage-tile strong, .source-usage-tile span { display: block; }
.source-usage-tile strong { color: var(--green); font: 600 1.6rem Georgia, serif; }
.source-usage-tile span { margin-top: .15rem; color: var(--muted); font-size: .65rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.source-connection-summary { display: flex; flex-wrap: wrap; gap: .45rem .8rem; margin-top: .7rem; }
.source-connection-summary span { display: inline-flex; align-items: baseline; gap: .24rem; padding: .38rem .52rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #faf8f1; font-size: .67rem; }
.source-connection-summary strong { color: var(--green); font-size: .78rem; }
.source-graph-toolbar { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .65rem; }
.source-graph-toolbar .source-chip { cursor: pointer; }
.source-graph-toolbar .source-chip.active { border-color: var(--green); color: #fff; background: var(--green); }
.source-graph-legend { display: flex; flex-wrap: wrap; gap: .45rem 1rem; margin-bottom: .8rem; padding: .65rem .75rem; border-radius: 6px; color: var(--muted); background: #f3eee3; font-size: .67rem; }
.source-graph-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.source-link-dot { width: .58rem; height: .58rem; display: inline-block; border-radius: 50%; background: var(--green); }
.source-link-dot.controlled { background: var(--gold); }
.source-link-dot.inherited { border: 1px solid #a86c2c; background: #fff8e8; }

@media (max-width: 1150px) {
    .source-overview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .source-overview-grid { grid-template-columns: 1fr 1fr; }
    .source-overview-card:first-child { grid-column: span 2; }
    .source-audit-grid { grid-template-columns: 1fr; }
}


/* Editable source-material profiles */
.source-witness-authoring-panel { margin-top: 1rem; border-color: #d8c79e; background: linear-gradient(180deg, #fffdf8 0%, #fbf7ed 100%); }
.source-witness-profile-form { margin-bottom: 1.1rem; }
.source-witness-authoring-list { display: grid; gap: 1rem; }
.source-witness-authoring-instrument { padding: 1rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.source-witness-authoring-instrument > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .9rem; }
.source-witness-authoring-instrument > header strong { display: block; color: var(--green); font: 600 1.05rem Georgia, serif; }
.source-witness-authoring-parts { display: grid; gap: .75rem; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.source-witness-authoring-part { padding: .9rem; border: 1px solid #ddd3bf; border-radius: 8px; background: #faf8f1; }
.source-witness-authoring-part-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .7rem; }
.source-witness-authoring-part-heading strong { color: var(--green); }
.source-witness-authoring-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; margin-top: 1rem; }
.source-witness-authoring-spacer { flex: 1 1 auto; }
.source-controlled-transcription { margin: .55rem 0 0; padding: .6rem .75rem; border-left: 3px solid var(--green-2); border-radius: 0 5px 5px 0; color: var(--ink); background: #eef2ea; font: 500 .78rem/1.55 Georgia, serif; white-space: pre-line; }

@media (max-width: 760px) {
    .source-witness-authoring-instrument > header, .source-witness-authoring-part-heading { align-items: flex-start; flex-direction: column; }
    .source-witness-authoring-spacer { display: none; }
}

/* Primary source witness hierarchy */
#source-material, #archive-coverage, #research-graph { scroll-margin-top: 96px; }
.source-primary-witness-card { overflow: hidden; background: linear-gradient(180deg, #fffdf7 0%, #f7f1e4 100%); }
.source-primary-witness-card h2 { margin-bottom: .55rem; }
.source-witness-summary { margin: .85rem 0; color: var(--muted); line-height: 1.6; }
.source-witness-hero { position: relative; display: block; margin: .85rem 0 1rem; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #e9e4d8; }
.source-witness-hero img { display: block; width: 100%; height: 235px; object-fit: cover; object-position: center; transition: transform .2s ease; }
.source-witness-hero:hover img { transform: scale(1.015); }
.source-witness-hero > span { position: absolute; left: .7rem; bottom: .7rem; padding: .38rem .55rem; border-radius: 6px; color: #fff; background: rgba(23,56,44,.9); font-size: .68rem; font-weight: 750; }
.source-witness-status { display: flex; flex-wrap: wrap; gap: .4rem; margin: .75rem 0; }
.source-witness-actions { margin-top: .9rem; }
.source-witness-panel { overflow: hidden; }
.source-witness-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; margin: 1rem 0 1.35rem; }
.source-witness-image-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #faf8f1; box-shadow: 0 5px 14px rgba(34,47,38,.05); }
.source-witness-image-card:hover { border-color: var(--gold); color: var(--ink); box-shadow: 0 8px 20px rgba(34,47,38,.1); }
.source-witness-image-card img, .source-witness-file-placeholder { display: block; width: 100%; height: 230px; object-fit: cover; background: #e8e2d6; }
.source-witness-file-placeholder { display: grid; place-items: center; color: var(--muted); font: 500 1rem Georgia, serif; }
.source-witness-image-card > span { display: block; padding: .75rem .85rem; }
.source-witness-image-card strong, .source-witness-image-card small { display: block; overflow-wrap: anywhere; }
.source-witness-image-card strong { color: var(--green); }
.source-witness-image-card small { margin-top: .25rem; }
.source-instrument-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: .5rem; }
.source-instrument-card { min-width: 0; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 9px; background: #fffdf8; }
.source-instrument-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; }
.source-instrument-heading h3 { margin: 0; font: 600 1.05rem Georgia, serif; }
.source-instrument-card > p { margin: .6rem 0 .85rem; color: var(--muted); font-size: .79rem; line-height: 1.55; }
.source-witness-part-list { display: grid; gap: .5rem; }
.source-witness-part { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .75rem; padding: .7rem .75rem; border-left: 3px solid var(--gold); border-radius: 5px; background: #f6f1e6; }
.source-witness-part > div { min-width: 0; }
.source-witness-part strong, .source-witness-part span, .source-witness-part small { display: block; }
.source-witness-part strong { color: var(--green); font-size: .78rem; }
.source-witness-part span { margin-top: .12rem; font-weight: 700; }
.source-witness-part small { margin-top: .2rem; line-height: 1.45; }
.source-witness-part.boundary-context { border-left-color: #aaa493; background: #f2f0ea; }
.source-witness-part.boundary-context strong { color: var(--muted); }
.source-witness-caution { margin: 1.25rem 0 0; }
.source-controlled-edition { display: flex; justify-content: space-between; align-items: center; gap: 1.25rem; margin-top: 1.25rem; padding: 1rem 1.1rem; border: 1px solid #d8c79e; border-radius: 9px; background: #fff8e8; }
.source-controlled-edition h3 { margin: 0; font: 600 1.05rem Georgia, serif; }
.source-controlled-edition p { max-width: 850px; margin: .35rem 0 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.source-coverage-panel .source-usage-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }

@media (max-width: 1150px) {
    .source-witness-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .source-instrument-list { grid-template-columns: 1fr; }
    .source-coverage-panel .source-usage-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .source-witness-gallery { grid-template-columns: 1fr; }
    .source-witness-hero img, .source-witness-image-card img, .source-witness-file-placeholder { height: 200px; }
    .source-witness-part { grid-template-columns: 1fr; }
    .source-controlled-edition { align-items: flex-start; flex-direction: column; }
    .source-coverage-panel .source-usage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Database-backed locations map */
.location-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.location-summary > div { min-height: 100px; padding: 1rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); box-shadow: 0 6px 20px rgba(40,48,40,.04); }
.location-summary > div.warning { border-color: #dfc391; background: #fbf4e5; }
.location-summary span, .location-summary strong { display: block; }
.location-summary span { min-height: 2.2em; color: var(--muted); font-size: .68rem; font-weight: 750; letter-spacing: .07em; line-height: 1.35; text-transform: uppercase; }
.location-summary strong { margin-top: .45rem; color: var(--green); font: 500 2rem Georgia, serif; }
.location-scope-note { margin-bottom: 1rem; padding: .85rem 1rem; border-left: 4px solid var(--gold); border-radius: 0 7px 7px 0; color: #5e563f; background: var(--gold-soft); font-size: .82rem; line-height: 1.55; }
.location-scope-note strong { color: var(--ink); }
.location-workspace { display: grid; grid-template-columns: minmax(260px, 315px) minmax(0, 1fr); align-items: start; gap: 1rem; }
.location-filter-panel { position: sticky; top: 96px; max-height: calc(100vh - 116px); overflow: auto; padding: 1.15rem; box-shadow: none; }
.location-filter-panel .panel-heading { align-items: center; }
.location-filter-count { padding: .25rem .45rem; border-radius: 99px; color: #76541f; background: var(--gold-soft); font-size: .65rem; font-weight: 750; }
.location-scope-filter { display: grid; gap: .4rem; color: var(--muted); font-size: .75rem; font-weight: 700; }
.location-filter-group { min-width: 0; margin: 1rem 0 0; padding: .8rem 0 0; border: 0; border-top: 1px solid var(--line); }
.location-filter-group legend { padding: .8rem 0 0; color: var(--muted); font-size: .7rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.location-filter-options { display: flex; flex-wrap: wrap; gap: .45rem; }
.location-filter-options.stacked { display: grid; gap: .2rem; }
.location-filter-options.scrollable { max-height: 240px; margin-top: .6rem; padding-right: .25rem; overflow-y: auto; }
.location-filter-options label { display: flex; align-items: center; gap: .4rem; min-width: 0; padding: .24rem .35rem; border-radius: 5px; color: var(--ink); cursor: pointer; font-size: .75rem; line-height: 1.35; }
.location-filter-options label:hover { background: #f2eee4; }
.location-filter-options label > span:not(.badge) { overflow-wrap: anywhere; }
.location-filter-options input { flex: 0 0 auto; margin: 0; accent-color: var(--green); }
.location-event-type-filter { margin-top: 1rem; padding-top: .85rem; border-top: 1px solid var(--line); }
.location-event-type-filter summary { display: flex; justify-content: space-between; gap: .75rem; color: var(--green); cursor: pointer; font-size: .76rem; font-weight: 750; }
.location-event-type-filter summary span { color: var(--muted); font-size: .68rem; font-weight: 600; }
.location-filter-actions { margin-top: 1rem; }
.location-filter-actions .button { flex: 1 1 auto; padding: .6rem .7rem; font-size: .75rem; }
.location-filter-help { display: block; margin-top: .75rem; line-height: 1.45; }

.location-map-panel { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.location-map-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: .8rem; }
.location-map-heading h2 { margin: 0; }
.location-map-shell { position: relative; min-height: 590px; overflow: hidden; border: 1px solid #c9c2b3; border-radius: 8px; isolation: isolate; background: #e5e8df; }
.locations-map { z-index: 0; width: 100%; height: min(68vh, 760px); min-height: 590px; background: #e5e8df; }
.location-map-loading { position: absolute; inset: 0; z-index: 900; display: grid; place-items: center; color: white; background: rgba(23,56,44,.42); pointer-events: none; }
.location-map-loading span { padding: .55rem .8rem; border-radius: 99px; background: rgba(23,56,44,.92); font-size: .76rem; font-weight: 750; }
.location-map-guidance { margin: .75rem .15rem 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.location-map-error { margin-bottom: 0; }
.location-map-unavailable { min-height: 590px; display: grid; place-content: center; padding: 2rem; color: var(--muted); text-align: center; }
.location-map-notice { max-width: 280px; padding: .55rem .7rem; border: 1px solid #d2b775; border-radius: 6px; color: #5f4820; background: rgba(255,248,232,.96); box-shadow: 0 4px 12px rgba(40,48,40,.12); font-size: .7rem; line-height: 1.4; }
.location-map-attribution { padding: 2px 5px !important; font-size: 10px !important; }
.location-marker-icon { display: grid !important; place-items: center; border: 2px solid #fffdf7; border-radius: 50%; color: white; background: var(--green); box-shadow: 0 3px 9px rgba(23,56,44,.34); font: 800 .72rem/1 Inter, Aptos, "Segoe UI", sans-serif; }
.location-marker-icon:hover { background: var(--green-2); transform: scale(1.06); }
.location-marker-icon:focus { outline: 3px solid var(--gold); outline-offset: 3px; }
.location-marker-icon span { pointer-events: none; }
.location-popup { min-width: 250px; max-height: 430px; overflow: auto; color: var(--ink); }
.location-popup header { padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.location-popup h3 { margin: .15rem 0 0; color: var(--green); font: 600 1.2rem/1.2 Georgia, serif; }
.location-popup-reference { color: var(--gold); font-size: .62rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.location-popup-summary { margin: .55rem 0; color: var(--muted); font-size: .72rem; }
.location-popup h4 { margin: .75rem 0 .25rem; color: var(--muted); font-size: .63rem; letter-spacing: .09em; text-transform: uppercase; }
.location-popup-list { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.location-popup-list li { padding: .42rem .5rem; border-radius: 5px; background: #f6f2e8; }
.location-popup-list a, .location-popup-list strong, .location-popup-list small { display: block; }
.location-popup-list a, .location-popup-list strong { color: var(--green); font-size: .76rem; font-weight: 750; }
.location-popup-list small { margin-top: .12rem; color: var(--muted); font-size: .65rem; line-height: 1.35; }
.location-popup-list details { margin-top: .3rem; color: var(--muted); font-size: .65rem; }
.location-popup-list details summary { cursor: pointer; font-weight: 700; }
.location-popup-list details p { margin: .3rem 0 0; line-height: 1.45; white-space: pre-line; }

.location-coordinate-panel, .location-unmapped-panel { margin-top: 1rem; }
.location-coordinate-panel > p, .location-unmapped-intro { color: var(--muted); font-size: .82rem; line-height: 1.55; }
.location-coordinate-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) auto; align-items: start; gap: 1rem; }
.location-coordinate-form label { display: grid; gap: .35rem; color: var(--muted); font-size: .75rem; font-weight: 700; }
.location-coordinate-form .button-row { align-self: end; padding-bottom: 1px; }
.location-unmapped-list { display: grid; gap: .6rem; }
.location-unmapped-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 1rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 8px; background: #faf8f1; }
.location-unmapped-row strong, .location-unmapped-row small { display: block; }
.location-unmapped-row small { margin-top: .18rem; }
.location-unmapped-row p { margin: .35rem 0 0; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.location-unmapped-row .button { padding: .55rem .75rem; font-size: .72rem; }
.location-unmapped-counts { display: flex; gap: .4rem; }
.location-unmapped-counts span { min-width: max-content; padding: .25rem .45rem; border-radius: 99px; color: var(--muted); background: #e8e5dc; font-size: .65rem; font-weight: 700; }
.location-no-place-action { max-width: 160px; text-align: right; }

@media (max-width: 1250px) {
    .location-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .location-workspace { grid-template-columns: minmax(240px, 280px) minmax(0, 1fr); }
}

@media (max-width: 900px) {
    .location-workspace { grid-template-columns: 1fr; }
    .location-filter-panel { position: static; max-height: none; }
    .location-filter-options.scrollable { max-height: 200px; }
    .location-map-shell, .locations-map, .location-map-unavailable { min-height: 500px; }
    .location-coordinate-form { grid-template-columns: 1fr 1fr; }
    .location-coordinate-form .button-row { grid-column: span 2; }
}

@media (max-width: 760px) {
    .location-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .location-map-heading { align-items: flex-start; flex-direction: column; }
    .location-map-shell, .locations-map, .location-map-unavailable { min-height: 430px; }
    .locations-map { height: 58vh; }
    .location-coordinate-form { grid-template-columns: 1fr; }
    .location-coordinate-form .button-row { grid-column: auto; }
    .location-unmapped-row { grid-template-columns: 1fr; align-items: start; }
    .location-unmapped-counts { flex-wrap: wrap; }
    .location-no-place-action { max-width: none; text-align: left; }
}

/* The documented family story */
.story-start-card { display: flex; align-items: center; justify-content: space-between; gap: 2rem; margin-bottom: 1.5rem; padding: 1.7rem 2rem; border: 1px solid #cfbb8f; border-radius: 10px; background: linear-gradient(120deg, #fffaf0, #eee7d5); }
.story-start-card h2 { margin-bottom: .5rem; font-size: 1.8rem; }
.story-start-card p { max-width: 780px; margin: 0; color: var(--muted); line-height: 1.6; }
.story-start-card .button { flex: 0 0 auto; gap: .8rem; }
.our-story-page { max-width: 1260px; margin: 0 auto; }
.story-cover { padding: 2.5rem 2.7rem; border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: 9px; background: var(--surface); box-shadow: var(--shadow); }
.story-cover h1 { max-width: 900px; color: var(--green); font-size: clamp(2.35rem, 4.5vw, 4rem); line-height: 1.13; }
.story-introduction { max-width: 920px; margin-bottom: 1.4rem; color: #50594f; font: 1.14rem/1.8 Georgia, "Times New Roman", serif; white-space: pre-line; }
.story-edition-line { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; color: var(--muted); font-size: .8rem; }
.story-cover-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem 1rem; margin-top: 1.5rem; }
.story-cover-actions .button { font-size: .8rem; }
.story-notice { margin: 1rem 0; padding: .9rem 1.15rem; border-left: 4px solid var(--gold); border-radius: 0 6px 6px 0; color: #65542f; background: #f5eacb; font-size: .86rem; line-height: 1.6; }
.story-at-a-glance { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; margin: 1.5rem 0 2rem; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.story-at-a-glance > div { padding: 1.1rem .85rem; text-align: center; background: #eee9de; }
.story-at-a-glance strong { display: block; color: var(--green); font: 1.8rem/1.1 Georgia, serif; }
.story-at-a-glance span { display: block; margin-top: .45rem; color: #626960; font-size: .73rem; }
.story-reader-layout { display: grid; grid-template-columns: minmax(190px, 240px) minmax(0, 1fr); gap: 2rem; align-items: start; }
.story-contents { position: sticky; top: 100px; max-height: calc(100vh - 125px); overflow: auto; padding: .8rem 0 1rem; }
.story-contents nav { display: grid; gap: .25rem; margin-bottom: 1.4rem; }
.story-contents nav a { display: flex; align-items: baseline; gap: .65rem; padding: .6rem .5rem; border-bottom: 1px solid var(--line); font-size: .8rem; line-height: 1.5; }
.story-contents nav a span { flex: 0 0 1.6rem; color: var(--gold); font-size: .7rem; font-weight: 750; }
.story-contents nav a:hover { color: var(--green); background: #ece6d7; }
.story-history-label { display: block; margin-bottom: .4rem; color: var(--muted); font-size: .75rem; font-weight: 700; }
.story-contents select { padding: .6rem; font-size: .73rem; }
.story-contents > small { display: block; margin-top: .4rem; font-size: .73rem; }
.story-sidebar-note { margin: 1.25rem 0 .8rem; color: var(--muted); font-size: .77rem; line-height: 1.65; }
.story-writer-label { display: inline-block; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: .7rem; }
.story-book { min-width: 0; padding: 2.2rem 2.6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.story-chapter { scroll-margin-top: 100px; padding: 2rem 0 0; margin-top: 2rem; border-top: 1px solid var(--line); }
.story-chapter:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.story-chapter > h2 { margin-bottom: .9rem; color: var(--green); font-size: clamp(1.65rem, 2.4vw, 2.3rem); line-height: 1.25; }
.story-chapter-introduction { color: var(--muted); font: 1.05rem/1.75 Georgia, serif; white-space: pre-line; }
.story-passage { padding: 1.65rem 0; border-bottom: 1px solid #e8e1d4; }
.story-passage:last-child { padding-bottom: 0; border-bottom: 0; }
.story-passage-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: .8rem; }
.story-passage h3 { max-width: 100%; margin: 0; color: var(--green); font: 600 1.24rem/1.45 Georgia, serif; overflow-wrap: anywhere; }
.story-passage-labels { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.story-review-label { color: var(--muted); font-size: .68rem; }
.story-prose { margin-bottom: 1rem; color: #303b30; font: 1.05rem/1.85 Georgia, "Times New Roman", serif; white-space: pre-line; overflow-wrap: anywhere; }
.story-caution { margin: .6rem 0; padding: .7rem .85rem; border-left: 3px solid #c1a05f; color: #6b5a37; background: #faf3e3; font-size: .83rem; line-height: 1.65; white-space: pre-line; }
.story-record-links { display: flex; flex-wrap: wrap; gap: .35rem .7rem; margin-top: .6rem; }
.story-record-links a { max-width: 100%; padding: .3rem .5rem; border: 1px solid #dcd4c5; border-radius: 5px; color: var(--green-2); background: #f4f1e7; font-size: .73rem; line-height: 1.5; overflow-wrap: anywhere; }
.story-record-links a:hover { border-color: var(--gold); background: #eee5d0; }
.story-citations { margin-top: 1rem; padding: .75rem 0 0; border-top: 1px dotted var(--line); }
.story-citations > summary, .story-changes > summary, .story-method > summary, .story-note-editor > summary { color: var(--green); cursor: pointer; font-size: .8rem; font-weight: 700; line-height: 1.5; }
.story-citations > summary span, .story-changes > summary span { margin-left: .6rem; color: var(--muted); font-weight: 400; }
.story-citation-list { display: grid; gap: .75rem; margin-top: .85rem; }
.story-citation { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 7px; background: #f8f5ed; }
.story-citation-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem; font-size: .8rem; line-height: 1.5; }
.story-citation-heading strong { overflow-wrap: anywhere; }
.story-citation dl, .story-method dl { display: grid; gap: .45rem; margin: .8rem 0; }
.story-citation dl > div, .story-method dl > div { display: grid; grid-template-columns: 125px minmax(0, 1fr); gap: .65rem; font-size: .73rem; line-height: 1.6; }
.story-citation dt, .story-method dt { color: var(--muted); }
.story-citation dd, .story-method dd { margin: 0; overflow-wrap: anywhere; }
.story-citation code, .story-method code { font-size: .66rem; overflow-wrap: anywhere; }
.story-citation p { margin: .6rem 0; color: #566052; font-size: .79rem; line-height: 1.65; white-space: pre-line; overflow-wrap: anywhere; }
.story-citation small { font-size: .72rem; }
.story-citation-gap { display: block; margin-top: .75rem; font-size: .74rem; line-height: 1.55; }
.story-changes { margin-bottom: 1.6rem; padding: .9rem 1rem; border: 1px solid #d8c79e; border-radius: 7px; background: #faf1dd; }
.story-changes ul { margin-bottom: 0; padding-left: 1.2rem; color: #65583b; font-size: .78rem; line-height: 1.65; }
.story-editorial-note { margin-bottom: 1.8rem; padding: 1.2rem; border: 1px solid #cfc5ab; border-left: 4px solid var(--gold); border-radius: 7px; background: #faf5e7; }
.story-editorial-note h2 { color: var(--green); font-size: 1.5rem; }
.story-editorial-note > small { display: block; margin-top: .75rem; line-height: 1.5; }
.story-empty-chapter { color: var(--muted); font-style: italic; font-size: .85rem; line-height: 1.7; }
.story-issue { padding: 1.2rem 0; border-bottom: 1px solid var(--line); }
.story-issue:last-child { border-bottom: 0; }
.story-issue h3 { margin-bottom: .5rem; color: var(--green); font: 600 1.12rem/1.45 Georgia, serif; }
.story-issue p { color: #5d6358; font-size: .85rem; line-height: 1.7; white-space: pre-line; overflow-wrap: anywhere; }
.story-method { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.story-method > p { margin: .85rem 0; color: var(--muted); font-size: .79rem; line-height: 1.65; }
.story-note-editor { margin: 1.5rem 0 0; padding: 1.2rem 1.5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.story-note-editor > summary { font-size: .9rem; }
.story-note-editor p { color: var(--muted); font-size: .82rem; line-height: 1.65; }
.story-note-editor > p { margin-top: .9rem; }
.story-note-editor > label { display: block; margin: .8rem 0 .4rem; color: var(--muted); font-size: .78rem; font-weight: 700; }
.story-note-editor > small { display: block; margin-top: .5rem; font-size: .74rem; line-height: 1.5; }
.story-note-editor fieldset { min-width: 0; margin: 1rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 6px; }
.story-note-editor legend { padding: 0 .4rem; color: var(--muted); font-size: .77rem; font-weight: 700; }
.story-reference-help { margin-bottom: .65rem; }
.story-note-records { display: grid; gap: .45rem; max-height: 240px; overflow: auto; padding-right: .4rem; }
.story-note-records label { display: flex; align-items: flex-start; gap: .65rem; padding: .4rem; border-radius: 5px; cursor: pointer; font-size: .78rem; line-height: 1.45; }
.story-note-records label:hover { background: #f2ead9; }
.story-note-records input { flex: 0 0 auto; margin-top: .2rem; accent-color: var(--green); }
.story-note-records span { min-width: 0; overflow-wrap: anywhere; }
.story-note-records small { display: block; font-size: .68rem; }
.story-note-editor > .story-note-review-check { display: flex; align-items: flex-start; gap: .65rem; margin: 1rem 0; padding: .85rem; border-radius: 6px; color: #65542f; background: #f5eacb; font-weight: 500; line-height: 1.6; }
.story-note-review-check input { flex: 0 0 auto; margin-top: .2rem; }
.our-story-page summary:focus-visible, .story-record-links a:focus-visible, .story-contents a:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

@media (max-width: 1050px) {
    .story-reader-layout { grid-template-columns: minmax(165px, 200px) minmax(0, 1fr); gap: 1.2rem; }
    .story-cover, .story-book { padding: 1.8rem; }
}
@media (max-width: 850px) {
    .story-reader-layout { grid-template-columns: 1fr; }
    .story-contents { position: static; max-height: none; padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
    .story-contents nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .story-at-a-glance { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .story-start-card { align-items: flex-start; flex-direction: column; gap: 1rem; }
}
@media (max-width: 520px) {
    .story-cover, .story-book, .story-start-card { padding: 1.25rem; }
    .story-cover h1 { font-size: 2.2rem; }
    .story-introduction, .story-prose { font-size: 1rem; }
    .story-at-a-glance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .story-contents nav { grid-template-columns: 1fr; }
    .story-citation dl > div, .story-method dl > div { grid-template-columns: 1fr; gap: .1rem; }
    .story-cover-actions .button { flex: 1 1 100%; }
    .story-note-editor { padding: 1rem; }
}
@media print {
    body:has(.our-story-page) { background: white; }
    body:has(.our-story-page) .app-shell { display: block; }
    body:has(.our-story-page) .sidebar, body:has(.our-story-page) .topbar, .our-story-page .story-screen-only { display: none !important; }
    body:has(.our-story-page) .content { max-width: none; padding: 0; }
    .our-story-page { max-width: none; color: #111; }
    .story-reader-layout { display: block; }
    .story-cover, .story-book { padding: 0; border: 0; border-radius: 0; box-shadow: none; background: white; }
    .story-cover { padding-bottom: 1rem; border-bottom: 2px solid #555; }
    .story-cover h1 { font-size: 28pt; }
    .story-introduction, .story-prose { color: #111; font-size: 11pt; line-height: 1.6; }
    .story-at-a-glance { margin: 1rem 0; grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .story-at-a-glance > div { padding: .55rem; background: white; }
    .story-chapter { margin-top: 1.5rem; padding-top: 1.5rem; }
    .story-chapter > h2 { font-size: 20pt; }
    .story-passage-heading, .story-chapter > h2, .story-citation-heading { break-after: avoid; }
    .story-citations > :not(summary), .story-method > :not(summary) { display: block !important; }
    .story-citations::details-content, .story-method::details-content { display: block !important; content-visibility: visible !important; }
    .story-citations > summary, .story-method > summary { list-style: none; margin-bottom: .5rem; }
    .story-citation { margin-bottom: .6rem; border-color: #aaa; background: white; break-inside: avoid; }
    .story-citation dl, .story-method dl { display: grid !important; }
    .story-citation-list { display: grid !important; }
    .story-citation code, .story-method code { font-size: 7pt; }
    .story-record-links a { color: #111; background: white; border-color: #aaa; }
    .story-caution, .story-editorial-note, .story-notice { color: #333; background: white; border-color: #777; }
    .badge { color: #333 !important; background: white !important; border: 1px solid #aaa; }
}
