:root {
    --brand: #0b72e7;
    --brand-soft: #e8f1fd;
    --ink: #0f172a;
    --muted: #475467;
    --faint: #667085;
    --line: #e4e7ec;
    --bg: #f8fafc;
    --card: #ffffff;
    --ok: #067647;
    --ok-soft: #ecfdf3;
    --warn: #b54708;
    --warn-soft: #fffaeb;
    --mark: #fff3c4;
    --radius: 12px;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }

/* Navigation */
.site-nav { position: sticky; top: 0; z-index: 50; background: rgba(248, 250, 252, 0.92); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.site-nav-inner { max-width: 1080px; margin: 0 auto; padding: 0 16px; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* Logo: same as the homepage (templates/index_seo_optimized.html). */
@font-face { font-family: Sora; font-style: normal; font-weight: 300 700; font-display: swap; src: url(/static/vendor/sora/sora-latin.fa26406eeda9.woff2) format(woff2); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -0.02em; }
.brand-icon { width: 32px; height: 32px; border-radius: 10px; background: #0b72e7; color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 12px rgba(11, 114, 231, 0.2); }
.brand-icon i { font-size: 16px; transform: translateY(1px); }
.brand-text { font-family: Sora, sans-serif; font-size: 1.15rem; font-weight: 800; text-transform: lowercase; color: #0f172a; }
.site-links { display: flex; align-items: center; gap: 16px; font-size: 15px; font-weight: 600; }
.site-links a { color: var(--ink); text-decoration: none; }
.site-links a[aria-current="page"] { color: var(--brand); }
.site-links .nav-cta { background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 999px; }

.page { max-width: 780px; margin: 0 auto; padding: 24px 16px 48px; }
.crumbs { font-size: 14px; color: var(--faint); margin-bottom: 12px; }
.crumbs a { color: var(--faint); text-decoration: none; }
.crumbs a:hover { color: var(--brand); }

/* Header */
.tx-header h1 { font-size: clamp(26px, 5vw, 36px); margin: 8px 0 8px; }
.tx-meta { color: var(--muted); margin: 0 0 12px; font-size: 15px; }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; padding: 6px 12px; border-radius: 999px; margin: 0 0 16px; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.status-ok { background: var(--ok-soft); color: var(--ok); }
.status-pending { background: var(--warn-soft); color: var(--warn); }
.tx-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: #b2ccff; background: #f5f8ff; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #0a63c9; border-color: #0a63c9; }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 32px; padding: 4px 12px; font-size: 14px; }
.btn:focus-visible, .chip:focus-visible, .ts:focus-visible, .seg-cite:focus-visible { outline: 3px solid #84adff; outline-offset: 2px; }

.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--brand-soft); color: #0a4fa3; font-size: 13px; font-weight: 600; text-decoration: none; }
.chip:hover { background: #d6e6fb; }
.chip-active { background: var(--brand); color: #fff; }
.chip-sm { padding: 2px 10px; font-size: 12px; }
.chip .count { opacity: 0.7; font-weight: 500; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 20px; }
.card h2 { font-size: 20px; margin: 0 0 12px; }
.card h3 { font-size: 15px; margin: 20px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.summary p { margin: 0; font-size: 17px; }
.fine { font-size: 13px; color: var(--faint); }

.quotes { margin: 0; padding: 0; list-style: none; counter-reset: q; }
.quotes li { counter-increment: q; border-top: 1px solid var(--line); }
.quotes li:first-child { border-top: 0; }
.quotes a { display: grid; grid-template-columns: 28px 1fr; column-gap: 8px; padding: 12px 0; text-decoration: none; color: var(--ink); }
.quotes a::before { content: counter(q); grid-row: span 2; width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: #0a4fa3; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.quotes a:hover .quote-text { color: var(--brand); }
.quote-text { font-size: 17px; font-weight: 500; }
.quote-meta { font-size: 13px; color: var(--faint); margin-top: 2px; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 0; }
.stat-grid div { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.stat-grid dt { font-size: 13px; color: var(--faint); }
.stat-grid dd { margin: 2px 0 0; font-size: 24px; font-weight: 700; }
.stat-grid small { font-size: 14px; font-weight: 500; color: var(--faint); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.speaker-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.speaker-table th, .speaker-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.speaker-table thead th { font-size: 12px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.speaker-table tbody th { font-weight: 600; }
.speaker-table .role { display: block; font-weight: 400; font-size: 12px; color: var(--faint); }
.speaker-table .num { text-align: right; white-space: nowrap; }
.bar { display: inline-block; vertical-align: middle; height: 6px; width: calc(var(--w) * 0.6); max-width: 60px; min-width: 2px; background: var(--brand); border-radius: 3px; margin-right: 6px; opacity: 0.7; }
.term-list, .word-cloud { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.term-list li, .word-cloud li { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 14px; }
.term-list b, .word-cloud b { color: var(--brand); margin-left: 4px; }

/* Transcript */
.transcript { margin: 32px 0 24px; }
.transcript-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; border-bottom: 2px solid var(--ink); margin-bottom: 8px; }
.transcript-head h2 { margin: 0 0 8px; font-size: 22px; }
.transcript-head p { margin: 0 0 8px; }
.seg { padding: 14px 12px; margin: 0 -12px; border-radius: 10px; transition: background 0.4s; }
.seg:target, .seg.is-target { background: #eef4ff; box-shadow: inset 3px 0 0 var(--brand); }
.seg-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 4px; }
.ts { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--brand); text-decoration: none; background: var(--brand-soft); padding: 2px 8px; border-radius: 6px; }
.ts:hover { background: #d6e6fb; }
.speaker { flex: 1 1 auto; min-width: 0; font-weight: 700; font-size: 14px; letter-spacing: 0.02em; text-transform: uppercase; }
.speaker .role { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--faint); margin-left: 6px; }
.seg-primary .speaker { color: #0a4fa3; }
.seg-cite { margin-left: auto; font: inherit; font-size: 13px; color: var(--faint); background: none; border: 0; padding: 2px 6px; border-radius: 6px; cursor: pointer; }
.seg-cite:hover { color: var(--brand); background: var(--brand-soft); }
.seg-body p { margin: 0 0 10px; font-size: 17px; line-height: 1.7; overflow-wrap: anywhere; }
.seg-body p:last-child { margin-bottom: 0; }
mark.kq { background: var(--mark); color: inherit; padding: 0 2px; border-radius: 3px; scroll-margin-top: 120px; }
mark.kq.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { background: #ffd84d; box-shadow: 0 0 0 4px #ffd84d; } 100% { background: var(--mark); box-shadow: none; } }
.ed-note { color: var(--warn); font-style: italic; }

.about .sources { padding-left: 20px; margin: 0; }
.about p { color: var(--muted); }
.notes summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 14px; }
.notes pre { white-space: pre-wrap; font-size: 13px; background: var(--bg); padding: 12px; border-radius: 8px; color: var(--muted); overflow-wrap: anywhere; }
.corrections { padding-left: 20px; color: var(--muted); }

/* Citation dialog */
.cite-dialog { border: 0; border-radius: 16px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 24px 64px rgba(15, 23, 42, 0.25); }
.cite-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.cite-inner { padding: 20px; }
.cite-top { display: flex; align-items: center; justify-content: space-between; }
.cite-top h2 { margin: 0; font-size: 20px; }
.icon-btn { font-size: 26px; line-height: 1; border: 0; background: none; cursor: pointer; color: var(--faint); padding: 4px 8px; }
.cite-block { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: start; border-top: 1px solid var(--line); padding: 12px 0; }
.cite-label { grid-column: 1 / -1; font-size: 12px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }
.cite-text { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.cite-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 100; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Library */
.lib-header h1 { font-size: clamp(28px, 5vw, 38px); margin: 8px 0 8px; }
.lede { font-size: 17px; color: var(--muted); margin: 0 0 20px; }
.topic-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.lib-list { list-style: none; padding: 0; margin: 0 0 24px; }
.lib-item { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 20px 0; border-top: 1px solid var(--line); }
.lib-date { font-size: 14px; color: var(--faint); padding-top: 4px; }
.lib-body h2 { margin: 0 0 4px; font-size: 20px; }
.lib-body h2 a { color: var(--ink); text-decoration: none; }
.lib-body h2 a:hover { color: var(--brand); }
.lib-speaker { margin: 0 0 6px; font-size: 14px; color: var(--muted); font-weight: 600; }
.lib-summary { margin: 0 0 10px; color: var(--muted); }
.lib-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-pending { background: var(--warn-soft); color: var(--warn); }
.empty { color: var(--muted); }
.lib-about p { color: var(--muted); }

@media (max-width: 600px) {
    .site-links { gap: 10px; font-size: 14px; }
    .site-links .nav-cta { display: none; }
    .card { padding: 16px; }
    .lib-item { grid-template-columns: 1fr; gap: 4px; }
    .seg { padding: 12px 8px; margin: 0 -8px; }
    .seg-body p { font-size: 16px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-grid dd { font-size: 20px; }
    .speaker-table .bar { display: none; }
    .tx-actions .btn { flex: 1 1 auto; }
    .status { border-radius: 10px; align-items: flex-start; }
    .status .dot { margin-top: 7px; }
    .seg-head { flex-wrap: nowrap; align-items: flex-start; gap: 10px; }
    .seg-head .ts { flex: none; }
    .speaker .role { display: block; margin-left: 0; font-size: 13px; }
}
@media print {
    .site-nav, .tx-actions, .seg-cite, .public-footer, .toast { display: none !important; }
    .card { border: 0; padding: 0; }
}
