:root {
    --pearl: #F5F0EB;
    --surface: #FFFFFF;
    --charcoal: #2C2C2C;
    --charcoal-light: #4A4A4A;
    --nacre: #8B7355;
    --nacre-light: #A89070;
    --sand: #D4C5B2;
    --sand-light: #E8DFD3;
    --border: #E5DDD4;
    --border-light: #F0EAE2;
    --muted: #9A9189;
    --bg-hover: #FAF7F3;

    --proceed: #5C8A6B;
    --caution: #C89B4A;
    --do-not-proceed: #B4543E;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--pearl);
    color: var(--charcoal);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ── Nav ─────────────────────────────────────────────────────── */
.nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.brand-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.18em;
    color: var(--charcoal);
}
.brand-sub {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--nacre);
}
.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
/* ── Nav hamburger menu ───────────────────────────────────── */
.nav-menu {
    position: relative;
}
.nav-menu > summary {
    list-style: none;
    cursor: pointer;
    outline: none;
    padding: 6px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
}
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu > summary::marker { display: none; }
.nav-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4.5px;
    width: 18px;
}
.nav-hamburger span {
    display: block;
    height: 1.5px;
    background: var(--charcoal);
    border-radius: 1px;
    transition: background 0.2s;
}
.nav-menu > summary:hover .nav-hamburger span { background: var(--nacre); }
.nav-menu-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px;
    min-width: 190px;
    box-shadow: 0 4px 16px rgba(44,44,44,0.10);
    z-index: 200;
}
.nav-menu-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--charcoal);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-menu-credits {
    font-size: 11px;
    color: var(--nacre);
    letter-spacing: 0.03em;
}
.nav-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 10px 0;
}
.nav-menu-signout {
    background: none;
    border: none;
    color: var(--charcoal);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    width: 100%;
    text-align: left;
}
.nav-menu-signout:hover { color: var(--nacre); }

/* ── Layout ──────────────────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

/* ── Search form ─────────────────────────────────────────────── */
.search-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(44, 44, 44, 0.04);
}
.search-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 28px;
    font-weight: 500;
    color: var(--charcoal);
    margin-bottom: 6px;
}
.search-subtitle {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 24px;
}
.field {
    margin-bottom: 16px;
}
.field-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--nacre);
    margin-bottom: 6px;
}
.field-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    color: var(--charcoal);
    background: var(--surface);
    transition: border-color 0.15s;
}
.field-input:focus {
    outline: none;
    border-color: var(--nacre);
}
.field-textarea {
    min-height: 80px;
    resize: vertical;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.btn-primary {
    background: var(--charcoal);
    color: var(--surface);
}
.btn-primary:hover { background: var(--charcoal-light); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--charcoal);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--nacre); }
.btn-link {
    background: none;
    border: none;
    color: var(--nacre);
    font-size: 12px;
    text-decoration: underline;
}

/* ── Investigation list ──────────────────────────────────────── */
.list-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-top: 24px;
}
.list-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.list-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--nacre);
}
.list-empty {
    padding: 40px 24px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}
.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.1s;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--bg-hover); }
.list-row-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--charcoal);
}
.list-row-meta {
    font-size: 12px;
    color: var(--muted);
}

/* ── Investigation view ──────────────────────────────────────── */
.inv-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 24px;
}
.inv-title-block h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 32px;
    font-weight: 500;
    color: var(--charcoal);
    margin-bottom: 4px;
}
.inv-context {
    font-size: 13px;
    color: var(--muted);
}
.inv-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--charcoal);
    white-space: nowrap;
}
.inv-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nacre);
    animation: pulse 1.4s ease-in-out infinite;
}
.inv-status.terminal .dot { animation: none; background: var(--proceed); }
.inv-status.failed .dot { animation: none; background: var(--do-not-proceed); }
@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ── Stage rail (compact, single-line, with connector lines) ─── */
.stages {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 24px;
    padding: 6px 2px;
    overflow-x: auto;
    scrollbar-width: none;
}
.stages::-webkit-scrollbar { display: none; }

.stage {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px 8px 10px;
    border-radius: 999px;
    background: transparent;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    white-space: nowrap;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}
.stage-name { color: inherit; margin: 0; font-size: inherit; letter-spacing: inherit; text-transform: inherit; }
.stage-state { display: none; }  /* state is expressed by the dot/colour, not text */

.stage-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.35;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.stage.pending { color: var(--muted); }
.stage.complete { color: var(--proceed); }
.stage.complete .stage-dot { opacity: 1; }
.stage.active {
    color: var(--charcoal);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(44, 44, 44, 0.06);
}
.stage.active .stage-dot {
    background: var(--nacre);
    opacity: 1;
    animation: stage-pulse 1.6s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(139, 115, 85, 0.5);
}
@keyframes stage-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(139, 115, 85, 0.45); transform: scale(1); }
    50%      { box-shadow: 0 0 0 6px rgba(139, 115, 85, 0);    transform: scale(1.15); }
}

/* Connector line between pills */
.stage + .stage::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 1px;
    background: var(--border);
    margin-right: 4px;
    flex-shrink: 0;
}

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.tab {
    background: none;
    border: none;
    padding: 10px 18px;
    font-family: inherit;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--charcoal); }
.tab.active {
    color: var(--charcoal);
    border-bottom-color: var(--nacre);
}
.tab-spacer { flex: 1; }
.tab-pdf-link {
    align-self: center;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--muted);
    text-decoration: none;
    padding: 6px 2px;
    transition: color 0.15s;
}
.tab-pdf-link:hover { color: var(--nacre); }

/* ── Network view ────────────────────────────────────────────── */
.network-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.network-toolbar {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.network-meta {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--nacre);
}
.network-stage {
    position: relative;
    min-height: 640px;
    background: var(--pearl);
}
.network-canvas {
    width: 100%;
    height: 640px;
}
.network-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 14px;
    padding: 32px;
    text-align: center;
}
.network-inspect {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 280px;
    max-height: calc(100% - 32px);
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px 18px;
    box-shadow: 0 4px 14px rgba(44, 44, 44, 0.08);
    font-size: 13px;
}
.network-inspect-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 20px;
    color: var(--charcoal);
    line-height: 1.2;
    margin-bottom: 8px;
}
.network-inspect-aliases {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 10px;
    font-style: italic;
}
.network-inspect-props {
    border-top: 1px solid var(--border-light);
    padding-top: 10px;
    margin-top: 4px;
}
.network-inspect-prop {
    font-size: 12px;
    line-height: 1.5;
    color: var(--charcoal-light);
    margin-bottom: 4px;
}

/* ── Timeline view (vis-timeline overrides) ──────────────────── */
.timeline-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.timeline-stage {
    position: relative;
    min-height: 120px;
    background: var(--pearl);
}
.timeline-canvas {
    width: 100%;
    padding: 16px 20px;
}
.timeline-canvas .vis-timeline {
    border: none;
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--pearl);
}
.timeline-canvas .vis-panel {
    border-color: var(--border-light);
}
.timeline-canvas .vis-time-axis .vis-text,
.timeline-canvas .vis-labelset .vis-label {
    color: var(--charcoal-light);
    font-size: 11px;
}
.timeline-canvas .vis-item {
    border-radius: 3px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--charcoal);
    box-shadow: 0 1px 2px rgba(44, 44, 44, 0.04);
    font-size: 12px;
    padding: 2px 6px;
}
.timeline-canvas .vis-item.vis-selected {
    border-color: var(--nacre);
    background: var(--bg-hover);
    box-shadow: 0 0 0 1px var(--nacre);
}
.timeline-canvas .vis-item.tl-career    { border-left: 3px solid var(--nacre); }
.timeline-canvas .vis-item.tl-education { border-left: 3px solid var(--nacre-light); }
.timeline-canvas .vis-item.tl-financial { border-left: 3px solid var(--proceed); }
.timeline-canvas .vis-item.tl-event     { border-left: 3px solid var(--sand); }
.timeline-canvas .vis-item.tl-public_appearance { border-left: 3px solid var(--charcoal-light); }
.timeline-canvas .vis-item.tl-personal  { border-left: 3px solid var(--sand-light); }
.timeline-canvas .vis-item.tl-adverse   { border-left: 3px solid var(--do-not-proceed); background: rgba(180, 84, 62, 0.05); }
.timeline-canvas .vis-item .vis-item-content strong { color: var(--charcoal); }
.timeline-canvas .vis-group { border-color: var(--border-light); }
.timeline-canvas .vis-tooltip {
    background: var(--charcoal);
    color: var(--surface);
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 12px;
    line-height: 1.5;
    padding: 10px 12px;
    border-radius: 4px;
    border: none;
    max-width: 340px;
}

/* ── Panels grid ─────────────────────────────────────────────── */
.panels {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}
@media (max-width: 900px) {
    .panels { grid-template-columns: 1fr; }
}
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.panel-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--nacre);
}
.panel-count {
    font-size: 11px;
    color: var(--muted);
}
.panel-body { padding: 16px 20px; }

/* Candidates */
.candidate {
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: all 0.15s;
}
.candidate:hover { border-color: var(--nacre); }
.candidate.confirmed { border-color: var(--proceed); background: rgba(92, 138, 107, 0.05); }
.candidate-photo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--sand-light);
    flex-shrink: 0;
}
.candidate-body { flex: 1; }
.candidate-name { font-weight: 600; font-size: 15px; }
.candidate-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.candidate-desc { font-size: 13px; color: var(--charcoal-light); margin-top: 8px; line-height: 1.5; }
.candidate-confidence {
    font-size: 11px;
    color: var(--nacre);
    margin-top: 8px;
}

/* Findings */
.finding {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}
.finding:last-child { border-bottom: none; }
.finding-track {
    display: inline-block;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--nacre);
    background: var(--sand-light);
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 6px;
}
.finding-summary { font-size: 13px; color: var(--charcoal); }
.finding-summary { display: block; margin-top: 4px; }
.finding-source {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--nacre);
    margin-top: 8px;
    text-decoration: none;
    word-break: break-all;
    line-height: 1.3;
}
.finding-source:hover { color: var(--charcoal); text-decoration: underline; }

/* ── Explore panel ───────────────────────────────────────────── */
.explore-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}
.explore-input {
    flex: 1;
}
.explore-qa {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}
.explore-question {
    font-size: 13px;
    font-weight: 600;
    color: var(--charcoal);
    margin-bottom: 12px;
}
.explore-sources {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.explore-sources-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--charcoal-light);
    margin-right: 4px;
}
.favicon {
    border-radius: 2px;
    flex-shrink: 0;
    vertical-align: middle;
}

/* Identifiers */
.lead {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    flex-wrap: wrap;
}
.lead:last-child { border-bottom: none; }
.lead-icon {
    width: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.lead-icon:empty { display: none; }
.lead-track {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--nacre);
    background: var(--sand-light);
    padding: 2px 6px;
    border-radius: 3px;
}
.lead-value {
    color: var(--charcoal);
    word-break: break-all;
    flex: 1;
    min-width: 120px;
    text-decoration: none;
}
a.lead-value { color: var(--nacre); }
a.lead-value:hover { color: var(--charcoal); text-decoration: underline; }
.lead-label {
    font-size: 11px;
    color: var(--muted);
}

/* Activity log */
.activity { max-height: 480px; overflow-y: auto; }
.activity-item {
    font-size: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-light);
    color: var(--charcoal-light);
    font-family: 'JetBrains Mono', SFMono-Regular, Menlo, monospace;
}
.activity-item:last-child { border-bottom: none; }
.activity-time { color: var(--muted); margin-right: 8px; }
.activity-stage {
    color: var(--nacre);
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.1em;
    margin-right: 6px;
}

/* Compliance screening */
.compliance-panel .panel-header .panel-count { font-weight: 600; color: var(--charcoal); }
.compliance-clean {
    padding: 14px 16px;
    border: 1px solid var(--sand);
    border-left: 3px solid var(--proceed);
    border-radius: 3px;
    background: rgba(92, 138, 107, 0.06);
    color: var(--charcoal-light);
    font-size: 13px;
    line-height: 1.5;
}
.compliance-clean strong { color: var(--proceed); }
.compliance-unconfigured {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--caution);
    border-radius: 3px;
    background: rgba(200, 155, 74, 0.05);
    color: var(--charcoal-light);
    font-size: 13px;
    line-height: 1.5;
}
.compliance-unconfigured strong { color: var(--caution); }
.compliance-unconfigured code {
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
    font-family: 'JetBrains Mono', SFMono-Regular, Menlo, monospace;
}
.compliance-hit {
    padding: 14px 16px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: 3px;
    background: var(--surface);
}
.compliance-hit:last-child { margin-bottom: 0; }
.compliance-hit.critical {
    border-left-color: var(--do-not-proceed);
    background: rgba(180, 84, 62, 0.04);
}
.compliance-hit.high { border-left-color: var(--caution); background: rgba(200, 155, 74, 0.05); }
.compliance-hit.medium { border-left-color: var(--nacre); }
.compliance-hit.low, .compliance-hit.info { border-left-color: var(--border); }
.compliance-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.compliance-badge {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 3px 8px;
    border-radius: 3px;
    font-weight: 600;
    background: var(--sand-light);
    color: var(--charcoal);
}
.compliance-badge.critical { background: var(--do-not-proceed); color: var(--surface); }
.compliance-badge.high { background: var(--caution); color: var(--surface); }
.compliance-badge.medium { background: var(--nacre); color: var(--surface); }
.compliance-source {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
}
.compliance-score {
    font-size: 11px;
    color: var(--nacre);
    margin-left: auto;
}
.compliance-summary {
    font-size: 13px;
    color: var(--charcoal);
    line-height: 1.5;
    margin-bottom: 6px;
}
.compliance-datasets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}
.compliance-dataset {
    font-size: 10px;
    color: var(--muted);
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    padding: 1px 6px;
    border-radius: 2px;
    font-family: 'JetBrains Mono', SFMono-Regular, Menlo, monospace;
}
.compliance-link {
    font-size: 11px;
    color: var(--nacre);
    text-decoration: none;
}
.compliance-link:hover { color: var(--charcoal); text-decoration: underline; }

/* Risk score */
.risk {
    padding: 20px;
    text-align: center;
}
.risk-score {
    font-family: 'Cormorant Garamond', serif;
    font-size: 56px;
    font-weight: 500;
    line-height: 1;
}
.risk-score.proceed { color: var(--proceed); }
.risk-score.caution { color: var(--caution); }
.risk-score.do_not_proceed { color: var(--do-not-proceed); }
.risk-verdict {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--muted);
    margin-top: 6px;
}
.risk-summary { font-size: 13px; color: var(--charcoal-light); margin-top: 12px; line-height: 1.6; }

/* Sections (synthesis brief) */
.section {
    border-top: 1px solid var(--border-light);
    padding: 24px 0;
}
.section:first-child { border-top: none; padding-top: 0; }
.section-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px;
    font-weight: 500;
    color: var(--charcoal);
    margin-bottom: 12px;
}
.section-content {
    font-size: 14px;
    color: var(--charcoal-light);
    line-height: 1.7;
}
.section-content.markdown { white-space: normal; }

/* Markdown styling — scoped so it doesn't bleed elsewhere */
.markdown p { margin: 0 0 12px; }
.markdown p:last-child { margin-bottom: 0; }
.markdown strong { color: var(--charcoal); font-weight: 600; }
.markdown em { font-style: italic; }
.markdown ul, .markdown ol { margin: 0 0 12px; padding-left: 22px; }
.markdown ul li, .markdown ol li { margin-bottom: 6px; }
.markdown ul { list-style: disc; }
.markdown ol { list-style: decimal; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
    font-family: 'Cormorant Garamond', serif;
    color: var(--charcoal);
    font-weight: 500;
    margin: 18px 0 10px;
    line-height: 1.3;
}
.markdown h1 { font-size: 22px; }
.markdown h2 { font-size: 19px; }
.markdown h3 { font-size: 16px; }
.markdown h4 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--nacre); }
.markdown a {
    color: var(--nacre);
    text-decoration: none;
    border-bottom: 1px solid var(--sand);
    transition: color 0.15s, border-color 0.15s;
    word-break: break-word;
}
.markdown a:hover { color: var(--charcoal); border-color: var(--nacre); }
.markdown code {
    font-family: 'JetBrains Mono', SFMono-Regular, Menlo, monospace;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
    color: var(--charcoal);
}
.markdown pre {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px 14px;
    overflow-x: auto;
    margin: 0 0 12px;
    font-size: 12px;
    line-height: 1.5;
}
.markdown pre code { background: none; border: none; padding: 0; }
.markdown blockquote {
    border-left: 3px solid var(--sand);
    margin: 0 0 12px;
    padding: 4px 14px;
    color: var(--charcoal-light);
    background: var(--bg-hover);
    font-style: italic;
}
.markdown hr {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 18px 0;
}
.markdown table {
    border-collapse: collapse;
    width: 100%;
    margin: 0 0 14px;
    font-size: 13px;
}
.markdown th, .markdown td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
}
.markdown th { background: var(--bg-hover); font-weight: 600; color: var(--charcoal); }
/* Clickable citation chips (rendered by renderMarkdown) */
.markdown button.cite,
button.cite {
    display: inline-block;
    background: var(--sand-light);
    color: var(--nacre);
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    margin: 0 2px;
    vertical-align: super;
    line-height: 1;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.markdown button.cite:hover,
button.cite:hover {
    background: var(--nacre);
    color: var(--surface);
    border-color: var(--nacre);
}

/* Evidence slide-in panel */
.evidence-wrap {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    justify-content: flex-end;
}
.evidence-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(44, 44, 44, 0.28);
}
.evidence-panel {
    position: relative;
    width: 100%;
    max-width: 520px;
    height: 100%;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 30px rgba(44, 44, 44, 0.10);
}
.evidence-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}
.evidence-kicker {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--nacre);
    margin-bottom: 4px;
}
.evidence-ref {
    font-family: 'Cormorant Garamond', serif;
    font-size: 28px;
    color: var(--charcoal);
    line-height: 1;
}
.evidence-close {
    background: none;
    border: none;
    font-size: 26px;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
}
.evidence-close:hover { color: var(--charcoal); }
.evidence-body {
    padding: 20px 24px 32px;
    overflow-y: auto;
    flex: 1;
}
.evidence-track {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--nacre);
    margin-bottom: 8px;
}
.evidence-summary {
    font-family: 'Cormorant Garamond', serif;
    font-size: 21px;
    font-weight: 500;
    color: var(--charcoal);
    line-height: 1.3;
    margin-bottom: 12px;
}
.evidence-content {
    font-size: 14px;
    color: var(--charcoal-light);
    line-height: 1.7;
    margin-bottom: 24px;
    white-space: pre-wrap;
}
.evidence-sourcebox {
    border: 1px solid var(--border);
    border-left: 3px solid var(--sand);
    border-radius: 3px;
    padding: 14px 16px;
    background: var(--bg-hover);
    margin-bottom: 18px;
}
.evidence-source-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--charcoal);
    margin: 4px 0 4px;
    word-break: break-word;
}
.evidence-source-url {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 10px;
    word-break: break-all;
    font-family: 'JetBrains Mono', SFMono-Regular, Menlo, monospace;
}
.evidence-source-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.evidence-archive-pending { font-size: 12px; color: var(--nacre); font-style: italic; }
.evidence-archive-failed { font-size: 12px; color: var(--caution); }
.evidence-archive-ts { font-size: 11px; color: var(--muted); margin-top: 8px; }
.evidence-confidence {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.evidence-error {
    color: var(--do-not-proceed);
    font-size: 13px;
}

/* Slide-in transition */
.evidence-enter-active, .evidence-leave-active { transition: transform 0.25s ease, opacity 0.2s ease; }
.evidence-enter-active .evidence-panel, .evidence-leave-active .evidence-panel { transition: transform 0.25s ease; }
.evidence-enter-from .evidence-panel, .evidence-leave-to .evidence-panel { transform: translateX(100%); }
.evidence-enter-from .evidence-backdrop, .evidence-leave-to .evidence-backdrop { opacity: 0; }
.evidence-enter-active .evidence-backdrop, .evidence-leave-active .evidence-backdrop { transition: opacity 0.2s ease; }

/* ── Auth pages ─────────────────────────────────────────────── */
.auth-body {
    background: var(--pearl);
    min-height: 100vh;
}
.auth-shell {
    min-height: 100vh;
    background: var(--pearl);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    gap: 32px;
}
.auth-brand {
    text-align: center;
}
.auth-brand-mark {
    font-family: 'Cormorant Garamond', serif;
    font-size: 56px;
    font-weight: 400;
    letter-spacing: 0.18em;
    color: var(--charcoal);
    line-height: 1;
}
.auth-brand-sub {
    margin-top: 12px;
    font-size: 16px;
    color: var(--nacre-light);
    letter-spacing: 0.04em;
    font-weight: 300;
}
.auth-card {
    width: 100%;
    max-width: 480px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 40px 44px 36px;
    box-shadow: 0 1px 3px rgba(44, 44, 44, 0.04);
}
.auth-form {
    display: flex;
    flex-direction: column;
}
.auth-heading {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--charcoal);
    padding-bottom: 14px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--nacre-light);
}
.auth-status {
    background: var(--sand-light);
    border: 1px solid var(--sand);
    color: var(--charcoal);
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 16px;
}
.auth-field {
    margin-bottom: 12px;
}
.auth-input {
    width: 100%;
    background: var(--pearl);
    border: 1px solid transparent;
    padding: 18px 20px;
    font-size: 15px;
    color: var(--charcoal);
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s;
}
.auth-input::placeholder {
    color: var(--sand);
    font-weight: 400;
}
.auth-input:focus {
    outline: none;
    border-color: var(--nacre);
    background: var(--bg-hover);
}
.auth-error {
    margin-top: 6px;
    font-size: 12px;
    color: var(--do-not-proceed);
}
.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    margin: 4px 0 16px;
    cursor: pointer;
}
.auth-remember input { accent-color: var(--nacre); }
.auth-submit {
    width: 100%;
    padding: 18px;
    background: var(--charcoal);
    color: var(--surface);
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.15s;
}
.auth-submit:hover { background: var(--charcoal-light); }
.auth-meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
    font-size: 12px;
}
.auth-meta a {
    color: var(--nacre);
    text-decoration: none;
}
.auth-meta a:hover { color: var(--charcoal); text-decoration: underline; }

/* Utility */
.row { display: flex; gap: 12px; align-items: center; }
.spacer { flex: 1; }
.muted { color: var(--muted); font-size: 12px; }
