:root {
    --bg:         #ffffff;
    --surface:    #f9fafb;
    --surface2:   #f3f4f6;
    --border:     #e5e7eb;
    --border-str: #111111;
    --text:       #111111;
    --muted:      #4b5563;
    --dim:        #9ca3af;
    --accent:     #b91c1c;
    --mono:       'Courier New', monospace;
    --serif:      Georgia, 'Times New Roman', serif;

    /* Sentiment colors */
    --c-bull: #16a34a;
    --c-opt:  #65a30d;
    --c-neu:  #6b7280;
    --c-pes:  #d97706;
    --c-bear: #dc2626;

    --spine-h: 58px;   /* legacy — kept for compat */
    --col-w: 260px;    /* width per node column */

    /* Tension arc layout */
    --arc-stage-h: 520px;   /* total height of arc stage */
    --arc-card-w: 240px;    /* card width */
    --arc-apex: 30px;       /* top padding (apex of arc) */
    --arc-base: 360px;      /* baseline Y for neutral cards */
}

/* Scoped resets — only inside the timeline app, don't touch global header/footer */
.tl-wrap * { box-sizing: border-box; }
.tl-wrap a { color: var(--accent); text-decoration: none; }
.tl-wrap a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════
   LAYOUT
═══════════════════════════════════════ */
.tl-wrap {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: 1fr;
    height: var(--tl-height, 100vh);
    overflow: hidden;
    font-family: var(--serif);
    font-size: 15px;
    line-height: 1.6;
    background: var(--bg);
    color: var(--text);
}

/* ── Topbar — hidden when global Glideslope header is present ── */
.tl-topbar { display: none; }
.tl-topbar .brand        { display: flex; align-items: center; gap: 10px; }
.tl-topbar .brand-name   { font-family: var(--mono); font-size: 11px; font-weight: 800; color: #fff; letter-spacing: .1em; text-transform: uppercase; }
.tl-topbar .brand-sep    { color: rgba(255,255,255,.2); }
.tl-topbar .page-title   { font-family: var(--mono); font-size: 11px; color: rgba(255,255,255,.5); letter-spacing: .06em; text-transform: uppercase; }
.tl-topbar .badge-admin  { background: var(--accent); color: #fff; font-family: var(--mono); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; padding: 2px 7px; border-radius: 2px; }
.tl-topbar .back-link    { margin-left: auto; font-family: var(--mono); font-size: 10px; color: rgba(255,255,255,.45); }
.tl-topbar .back-link:hover { color: #fff; text-decoration: none; }

/* ── Left sidebar ── */
.tl-left { background: var(--surface); border-right: 2px solid var(--border-str); display: flex; flex-direction: column; overflow: hidden; }
.tl-left-inner { flex: 1; overflow-y: auto; padding: 14px; }
.tl-left-inner::-webkit-scrollbar { width: 3px; }
.tl-left-inner::-webkit-scrollbar-thumb { background: var(--border); }
.panel-label { font-family: var(--mono); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.panel-section { margin-bottom: 20px; }
.search-input { width: 100%; background: #fff; border: 1px solid var(--border); border-bottom: 2px solid var(--border-str); color: var(--text); font-size: 12px; font-family: var(--serif); padding: 8px 10px; outline: none; margin-bottom: 8px; }
.search-input::placeholder { color: var(--dim); font-style: italic; }
.horizon-row { display: flex; border: 1px solid var(--border); border-bottom: 2px solid var(--border-str); overflow: hidden; margin-bottom: 8px; }
.horizon-btn { flex: 1; background: #fff; border: none; border-right: 1px solid var(--border); color: var(--muted); font-family: var(--mono); font-size: 10px; font-weight: 700; padding: 6px 0; cursor: pointer; }
.horizon-btn:last-child { border-right: none; }
.horizon-btn:hover { background: var(--surface2); }
.horizon-btn.active { background: #111; color: #fff; }
.build-btn { width: 100%; background: #111; border: none; color: #fff; font-family: var(--mono); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; padding: 10px; cursor: pointer; }
.build-btn:hover { background: var(--accent); }
.build-btn:disabled { background: var(--dim); cursor: not-allowed; }
.suggestion-chip { display: block; width: 100%; text-align: left; background: #fff; border: 1px solid var(--border); color: var(--muted); font-size: 11px; font-family: var(--serif); padding: 6px 9px; cursor: pointer; margin-bottom: 4px; }
.suggestion-chip:hover { border-color: var(--border-str); background: var(--surface2); }
.chip-headline { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); font-size: 11px; }
.chip-topic { display: block; font-family: var(--mono); font-size: 9px; color: var(--dim); margin-top: 1px; }
.recent-item { display: flex; align-items: center; justify-content: space-between; padding: 5px 6px; cursor: pointer; border-bottom: 1px solid var(--border); }
.recent-item:hover { background: var(--surface2); }
.recent-item .ri-topic { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.recent-item .ri-meta { font-family: var(--mono); font-size: 9px; color: var(--dim); flex-shrink: 0; }

/* ── Main area (holds everything except sidebar+topbar) ── */
.tl-main { display: flex; flex-direction: column; overflow: hidden; position: relative; }

/* ── Empty / Loading / Error states ── */
.tl-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.tl-spinner { width: 28px; height: 28px; border: 2px solid var(--border); border-top-color: var(--border-str); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tl-state-text  { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.tl-state-sub   { font-family: var(--mono); font-size: 9px; color: var(--dim); margin-top: -6px; }
.tl-state-rule  { width: 40px; height: 3px; background: var(--border); }
.tl-state-hint  { font-size: 13px; color: var(--dim); font-style: italic; max-width: 260px; text-align: center; line-height: 1.6; }
.tl-error-icon  { font-size: 24px; opacity: .3; }
.tl-error-msg   { font-family: var(--mono); font-size: 11px; color: var(--accent); max-width: 320px; text-align: center; }

/* ═══════════════════════════════════════
   HEADER BAR (above timeline)
═══════════════════════════════════════ */
.tl-header-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 16px 4px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: nowrap;
    overflow: hidden;
}
.tl-topic-name { font-family: var(--serif); font-size: 17px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tl-pill { font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--surface2); border: 1px solid var(--border); color: var(--muted); padding: 2px 8px; }
.tl-pill.fresh { color: var(--c-bull); border-color: var(--c-bull); background: #f0fdf4; }
.tl-cached-date { font-family: var(--mono); font-size: 9px; color: var(--dim); border: 1px solid var(--border); padding: 2px 8px; letter-spacing: .06em; text-transform: uppercase; }
.tl-regen-btn { font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: none; border: 1px solid var(--border); color: var(--dim); padding: 2px 8px; cursor: pointer; }
.tl-regen-btn:hover { border-color: var(--accent); color: var(--accent); }
.tl-share-btn { font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: none; border: 1px solid #1d4ed8; color: #1d4ed8; padding: 2px 8px; cursor: pointer; margin-left: auto; }
.tl-share-btn:hover { background: #1d4ed8; color: #fff; }
.tl-share-btn.copied { background: var(--c-bull); border-color: var(--c-bull); color: #fff; }
.tl-export-btn { font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: none; border: 1px solid #16a34a; color: #16a34a; padding: 2px 8px; cursor: pointer; }
.tl-export-btn:hover { background: #16a34a; color: #fff; }
.tl-export-btn:disabled { border-color: var(--dim); color: var(--dim); cursor: wait; }
.panel-hint { font-family: var(--mono); font-size: 10px; color: var(--dim); margin: 4px 0 0; line-height: 1.5; }

/* Narrative strip */
.tl-narrative-strip {
    padding: 4px 16px;
    background: var(--surface);
    border-bottom: 2px solid var(--border-str);
    flex-shrink: 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.tl-narrative-lbl { font-family: var(--mono); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); flex-shrink: 0; }
.tl-narrative-txt { font-family: var(--serif); font-size: 13px; color: var(--muted); line-height: 1.5; max-height: 48px; overflow-y: auto; flex: 1; min-width: 0; }
.tl-narrative-txt::-webkit-scrollbar { width: 3px; }
.tl-narrative-txt::-webkit-scrollbar-thumb { background: var(--border); }

/* ═══════════════════════════════════════
   KEYWORD THREAD BAR
═══════════════════════════════════════ */
.tl-kw-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
    overflow: hidden;
    padding: 3px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.tl-kw-bar-lbl { font-family: var(--mono); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); flex-shrink: 0; }
.kw-chip { font-family: var(--mono); font-size: 9px; padding: 2px 8px; border: 1px solid var(--border); background: #fff; color: var(--muted); cursor: pointer; border-radius: 2px; transition: all .15s; }
.kw-chip:hover { border-color: #d97706; color: #92400e; background: #fef9c3; }
.kw-chip.active { background: #d97706; border-color: #d97706; color: #fff; }
.kw-clear { font-family: var(--mono); font-size: 9px; color: var(--dim); background: none; border: none; cursor: pointer; margin-left: auto; }
.kw-clear:hover { color: var(--accent); }

/* ═══════════════════════════════════════
   TENSION ARC TIMELINE STAGE
═══════════════════════════════════════ */

/* ── Narrator bar: cinematic "where am I in the story" strip ── */
.tl-narrator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    height: 30px;
    background: #111;
    border-bottom: 1px solid #000;
    flex-shrink: 0;
    overflow: hidden;
    transition: background .4s;
}
.tl-narrator.tension-high  { background: #1a0505; }
.tl-narrator.tension-med   { background: #1a0d00; }
.tl-narrator.tension-low   { background: #0a1200; }
.tl-narrator-prog {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.tl-narrator-num {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 800;
    color: rgba(255,255,255,.35);
    letter-spacing: .08em;
    min-width: 36px;
}
.tl-narrator-dots {
    display: flex;
    gap: 3px;
    align-items: center;
}
.tl-narrator-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    transition: all .3s;
    flex-shrink: 0;
}
.tl-narrator-dot.active {
    background: #fff;
    transform: scale(1.4);
}
.tl-narrator-dot.critical-dot {
    background: rgba(185,28,28,.5);
    width: 7px;
    height: 7px;
}
.tl-narrator-dot.active.critical-dot { background: var(--accent); }

.tl-narrator-sep { color: rgba(255,255,255,.15); flex-shrink: 0; font-size: 10px; }
.tl-narrator-text {
    font-family: var(--serif);
    font-size: 12px;
    color: rgba(255,255,255,.75);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    font-style: italic;
}
.tl-narrator-sent {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
    padding: 2px 8px;
    flex-shrink: 0;
}

.tl-stage-wrap {
    flex: 1;
    min-height: 0;        /* prevent flex child from blowing out parent height */
    overflow-x: clip;     /* clip horizontal overflow (keeps nav arrows contained) */
    overflow-y: visible;  /* never clip the arc stage vertically — .tl-scroll handles it */
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Horizontal scroll container */
.tl-scroll {
    flex: 1;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    cursor: grab;
    user-select: none;
    position: relative;
}
.tl-scroll:active { cursor: grabbing; }
.tl-scroll::-webkit-scrollbar { height: 6px; }
.tl-scroll::-webkit-scrollbar-track { background: var(--surface2); }
.tl-scroll::-webkit-scrollbar-thumb { background: var(--border-str); }

/* ── Arc stage: fixed height, cards positioned absolutely ── */
.tl-stage {
    position: relative;
    min-width: max-content;
    height: var(--arc-stage-h);
    padding: 0 80px;
}

/* SVG arc overlay (drawn behind cards) */
.tl-arc-svg {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

/* ── Node column: absolutely positioned in arc ── */
.tl-col {
    position: absolute;
    width: var(--arc-card-w);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

/* Date label above card */
.tl-arc-date {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #fff;
    background: #111;
    padding: 3px 10px;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    outline: none;
    transition: background .15s;
    margin-bottom: 6px;
    position: relative;
    z-index: 5;
}
.tl-arc-date:hover { background: var(--accent) !important; }
.tl-arc-date.active-date { background: var(--accent) !important; color: #fff !important; }

/* The tension dot on the arc line */
.tl-arc-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #111;
    background: #fff;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
    margin-bottom: 8px;
    transition: transform .2s;
    cursor: pointer;
}
.tl-arc-dot:hover { transform: scale(1.4); }
.tl-arc-dot.critical {
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(185,28,28,.2);
}

/* Connection label between cards */
.tl-arc-conn {
    position: absolute;
    font-family: var(--mono);
    font-size: 8px;
    color: var(--dim);
    font-style: italic;
    white-space: nowrap;
    letter-spacing: .03em;
    background: rgba(255,255,255,.88);
    padding: 1px 6px;
    pointer-events: auto;
    cursor: pointer;
    /* Sit BELOW cards (cards are z-index 4) by default */
    z-index: 2;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all .2s ease;
    border-radius: 3px;
}
.tl-arc-conn:hover {
    color: #374151;
    background: rgba(255,255,255,1);
    /* Still under cards on hover — only expanded state pops above */
    z-index: 2;
}
.tl-arc-conn.expanded {
    white-space: normal;
    max-width: 320px;
    overflow: visible;
    text-overflow: unset;
    font-size: 11px;
    color: #111;
    font-style: normal;
    background: #fff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 16px rgba(0,0,0,.16);
    padding: 6px 10px;
    /* Pop above cards (z-index 4), scroll-focus cards (z-index 30), and nav arrows (z-index 100) */
    z-index: 50;
    line-height: 1.5;
    border-radius: 5px;
}

/* ── Node card: positioned inside .tl-col ── */
.tl-node-card {
    width: 100%;
    background: #fff;
    border: 1px solid var(--border);
    border-top: 3px solid var(--border-str);
    border-bottom: 2px solid var(--border-str);
    padding: 12px 14px;
    cursor: pointer;
    transition: transform .12s cubic-bezier(.22,1,.36,1),
                box-shadow .12s ease,
                border-color .1s ease,
                background .1s ease;
    opacity: 0;
    position: relative;
    z-index: 4;
    will-change: transform;
}
.tl-node-card.visible {
    opacity: 1;
}
.tl-node-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,.13);
    transform: translateY(-3px);
    z-index: 20;
}
.tl-node-card.active {
    border-color: var(--accent);
    border-top-color: var(--accent);
    background: #fffaf9;
    z-index: 20;
}
/* Rolodex scroll-focus: centered card pops hard */
.tl-node-card.scroll-focus {
    transform: translateY(-18px) scale(1.08);
    box-shadow: 0 28px 60px rgba(0,0,0,.28), 0 4px 12px rgba(185,28,28,.18);
    border-top: 4px solid var(--accent);
    border-color: var(--accent);
    background: #fff;
    z-index: 30;
}
.tl-node-card.scroll-focus:hover {
    transform: translateY(-21px) scale(1.08);
}
.tl-node-card.dimmed, .tl-vnode-body.dimmed { opacity: .15; pointer-events: none; }

/* Card innards */
.nc-sentiment {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 800;
    padding: 2px 7px;
    text-transform: uppercase;
    letter-spacing: .07em;
    display: inline-block;
    margin-bottom: 6px;
}
.nc-sentiment.Bullish     { background: #dcfce7; color: #15803d; }
.nc-sentiment.Optimistic  { background: #ecfccb; color: #4d7c0f; }
.nc-sentiment.Neutral     { background: #f3f4f6; color: #6b7280; }
.nc-sentiment.Pessimistic { background: #fef3c7; color: #b45309; }
.nc-sentiment.Bearish     { background: #fee2e2; color: #b91c1c; }

.nc-headline {
    font-family: var(--serif);
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.35;
    margin-bottom: 7px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.nc-summary {
    font-family: var(--serif);
    font-size: 12px;
    color: var(--muted);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}
.nc-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 5px;
}
.nc-stories {
    font-family: var(--mono);
    font-size: 9px;
    color: var(--dim);
    background: var(--surface2);
    border: 1px solid var(--border);
    padding: 1px 5px;
}
.nc-map-btn {
    font-family: var(--mono);
    font-size: 8px;
    font-weight: 700;
    color: #1d4ed8;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    padding: 1px 6px;
    cursor: pointer;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.nc-map-btn:hover { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }

/* Keyword tags on card */
.nc-kws { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.nc-kw {
    font-family: var(--mono); font-size: 9px; padding: 1px 5px;
    border: 1px solid var(--border); color: var(--dim); background: var(--surface);
    border-radius: 2px; cursor: pointer; transition: all .15s;
}
.nc-kw.shared { background: #fef9c3; border-color: #d97706; color: #92400e; }
.nc-kw.shared:hover { background: #fde68a; }
.nc-kw.hl { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Critical event marker ── */
.tl-node-card.critical {
    border-top-width: 3px;
    box-shadow: 0 2px 16px rgba(185,28,28,.15);
}
.nc-critical-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--accent);
    background: #fee2e2;
    border: 1px solid #fca5a5;
    padding: 2px 6px;
    margin-bottom: 6px;
}
.nc-critical-badge::before { content: '▲'; font-size: 7px; }

/* Spine compat classes (legacy — not rendered in arc mode) */
.tl-row-spine, .tl-row-cards, .tl-row-above, .tl-row-below,
.tl-spine-cell, .tl-spine-date, .tl-conn-label, .tl-sent-bar, .tl-spine-line { display: none; }

/* ── Nav arrows ── */
.tl-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: #fff;
    border: 2px solid var(--border-str);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    z-index: 100;
    transition: all .15s;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.tl-nav-arrow:hover { background: #111; color: #fff; border-color: #111; }
.tl-nav-left  { left: 8px; }
.tl-nav-right { right: 8px; }

/* ── Signal bar at bottom ── */
.tl-signal-bar {
    padding: 4px 16px;
    background: #fff;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.tl-signal-lbl { font-family: var(--mono); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); flex-shrink: 0; }
.tl-signal-txt { font-family: var(--serif); font-size: 13px; color: var(--muted); line-height: 1.4; max-height: 44px; overflow-y: auto; flex: 1; min-width: 0; }
.tl-signal-txt::-webkit-scrollbar { width: 3px; }
.tl-signal-txt::-webkit-scrollbar-thumb { background: var(--border); }

/* ═══════════════════════════════════════
   DETAIL PANEL (replaces arc content in tl-main)
   Pure document flow — no fixed/absolute positioning needed.
═══════════════════════════════════════ */
.tl-detail-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
}
.tl-detail-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 40px;
    background: #111;
    border-bottom: 2px solid var(--border-str);
    flex-shrink: 0;
}
.tl-detail-back {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: rgba(255,255,255,.6);
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0;
}
.tl-detail-back:hover { color: #fff; }
.tl-detail-back-arrow { font-size: 18px; font-weight: 300; line-height: 1; }
.tl-detail-progress {
    font-family: var(--mono);
    font-size: 9px;
    color: rgba(255,255,255,.3);
    letter-spacing: .06em;
}
.tl-detail-body {
    flex: 1;
    overflow-y: auto;
}
.tl-detail-body::-webkit-scrollbar { width: 4px; }
.tl-detail-body::-webkit-scrollbar-thumb { background: var(--border); }

/* Two-column layout on desktop: text left, map right */
.tl-detail-cols {
    display: grid;
    grid-template-columns: 1fr 340px;
    min-height: 100%;
}
.tl-detail-main {
    padding: 20px 24px;
    border-right: 1px solid var(--border);
}
.tl-detail-map-col {
    position: sticky;
    top: 0;
    align-self: start;
    height: var(--tl-height, 100vh);
    overflow: hidden;
}
.tl-detail-map-col .d-map-wrap {
    height: 100%;
    min-height: 300px;
    border-bottom: none;
}
.tl-detail-map-col .d-map-wrap .leaflet-container {
    height: 100% !important;
}

/* Drawer map */
.d-map-wrap {
    width: 100%;
    height: 240px;
    flex-shrink: 0;
    position: relative;
    background: #e8edf2;
    border-bottom: 2px solid var(--border-str);
}
.d-map-wrap .leaflet-container { height: 240px !important; }
.d-map-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #e8edf2;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--dim);
    z-index: 2;
    transition: opacity .3s;
}
.d-map-placeholder.hidden { opacity: 0; pointer-events: none; }
.d-map-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(17,17,17,.85);
    color: #fff;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
    padding: 3px 8px;
    z-index: 500;
    pointer-events: none;
}
.d-map-datebadge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--accent);
    color: #fff;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
    padding: 3px 8px;
    z-index: 500;
    pointer-events: none;
}
.d-map-open-link {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(17,17,17,.85);
    color: #fff;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 3px 10px;
    z-index: 500;
    border: 1px solid rgba(255,255,255,.2);
    text-decoration: none;
}
.d-map-open-link:hover { background: var(--accent); text-decoration: none; color: #fff; }

/* Drawer content */
.d-body { padding: 18px 20px; flex: 1; }
.d-date { font-family: var(--mono); font-size: 10px; font-weight: 800; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; }
.d-headline { font-family: var(--serif); font-size: 16px; font-weight: 800; line-height: 1.3; color: var(--text); margin-bottom: 10px; }
.d-headline a { color: inherit; text-decoration: none; }
.d-headline a:hover { color: var(--accent); }
.d-summary { font-family: var(--serif); font-size: 13px; color: var(--muted); line-height: 1.7; margin-bottom: 14px; }

/* Arc block */
.d-arc { border: 1px solid var(--border); margin-bottom: 14px; overflow: hidden; }
.d-arc-row { display: flex; gap: 0; font-family: var(--mono); font-size: 10px; line-height: 1.5; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.d-arc-row:last-child { border-bottom: none; }
.d-arc-row.arc-from    { background: #f9fafb; }
.d-arc-row.arc-current { background: #fffaf9; border-left: 3px solid var(--accent); }
.d-arc-row.arc-to      { background: #eff6ff; }
.d-arc-icon { width: 18px; flex-shrink: 0; font-size: 10px; padding-top: 1px; }
.d-arc-col  { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.d-arc-lbl  { font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 8px; color: var(--dim); }
.d-arc-txt  { color: var(--muted); font-size: 10px; }
.d-arc-jump { font-family: var(--serif); font-size: 10px; color: var(--muted); font-style: italic; cursor: pointer; margin-top: 2px; }
.d-arc-jump:hover { color: var(--accent); text-decoration: underline; }
.d-arc-row.arc-from    .d-arc-lbl { color: #6b7280; }
.d-arc-row.arc-current .d-arc-lbl { color: var(--accent); }
.d-arc-row.arc-to      .d-arc-lbl { color: #1d4ed8; }
.d-arc-row.arc-to      .d-arc-txt { color: #1d4ed8; font-weight: 700; }

.d-section-lbl { font-family: var(--mono); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
.d-citations { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.d-cite { background: var(--surface); border: 1px solid var(--border); padding: 7px 10px; }
.d-cite-title { font-family: var(--serif); font-size: 11px; color: var(--text); line-height: 1.4; margin-bottom: 2px; }
.d-cite-title a { color: inherit; text-decoration: none; }
.d-cite-title a:hover { color: var(--accent); }
.d-cite-meta  { font-family: var(--mono); font-size: 9px; color: var(--dim); }
.d-nav { display: flex; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.d-nav-btn { flex: 1; font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--surface2); border: 1px solid var(--border); border-bottom: 2px solid var(--border-str); color: var(--muted); padding: 7px 0; cursor: pointer; text-align: center; }
.d-nav-btn:hover:not(:disabled) { background: #111; color: #fff; border-color: #111; }
.d-nav-btn:disabled { opacity: .3; cursor: not-allowed; }
.d-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 8px;
    padding: 8px 0;
    background: none;
    border: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--accent);
    cursor: pointer;
}
.d-back-btn:hover { background: var(--surface); }
.d-back-arrow { font-size: 15px; font-weight: 400; line-height: 1; }

/* Hide hamburger on desktop — must come BEFORE the media query so mobile can override */
.tl-menu-btn { display: none; }

/* ── Sidebar toggle button (desktop) ── */
.tl-sidebar-toggle {
    font-family: var(--mono);
    font-size: 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-bottom: 2px solid var(--border-str);
    color: var(--muted);
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 4px;
    line-height: 1;
}
.tl-sidebar-toggle:hover { background: #111; color: #fff; border-color: #111; }

/* Collapsed sidebar: hide sidebar, give all width to main */
.tl-wrap.sidebar-collapsed { grid-template-columns: 1fr; }
.tl-wrap.sidebar-collapsed .tl-left { display: none; }

/* ═══════════════════════════════════════
   MOBILE
═══════════════════════════════════════ */
@media (max-width: 600px) {

    /* Full-screen single column — no sidebar */
    .tl-wrap {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }

    /* Sidebar becomes a slide-up bottom sheet */
    .tl-left {
        position: fixed;
        bottom: -100%;
        left: 0; right: 0;
        height: 70vh;
        border-right: none;
        border-top: 2px solid var(--border-str);
        z-index: 400;
        transition: bottom .3s cubic-bezier(.4,0,.2,1);
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -8px 32px rgba(0,0,0,.15);
    }
    .tl-left.mobile-open { bottom: 0; }

    /* Overlay behind bottom sheet */
    .tl-sidebar-overlay.open { display: block; }

    /* Hamburger button in topbar */
    .tl-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: 1px solid rgba(255,255,255,.2);
        color: #fff;
        font-size: 16px;
        width: 32px;
        height: 28px;
        cursor: pointer;
        flex-shrink: 0;
        margin-left: auto;
    }

    /* Main takes full grid column */
    .tl-main { grid-column: 1; }

    /* Header bar: wrap tighter, smaller topic name */
    .tl-header-bar { padding: 8px 12px 6px; gap: 6px; }
    .tl-topic-name { font-size: 16px; }
    .tl-narrative-strip { padding: 6px 12px; }
    .tl-narrative-txt { font-size: 13px; }
    .tl-kw-bar { padding: 5px 12px; }
    .tl-signal-bar { padding: 6px 12px; }

    /* ── Side-scrolling arc on mobile ── */
    .tl-scroll {
        overflow-x: auto;
        overflow-y: auto;  /* keep auto — never hard-clip cards on small screens */
        -webkit-overflow-scrolling: touch;
        cursor: grab;
    }
    .tl-scroll:active { cursor: grabbing; }

    /* Narrative strip toggle button */
    .tl-arc-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 4px 12px;
        background: var(--surface);
        border: none;
        border-bottom: 1px solid var(--border);
        font-family: var(--mono);
        font-size: 9px;
        font-weight: 700;
        letter-spacing: .08em;
        text-transform: uppercase;
        color: var(--dim);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        flex-shrink: 0;
    }
    .tl-arc-toggle:active { background: #ececec; }
    .tl-arc-toggle-chevron { font-size: 8px; }

    /* Narrative strip: collapse/expand */
    .tl-narrative-strip {
        overflow: hidden;
        max-height: 200px;
        transition: max-height .3s cubic-bezier(.4,0,.2,1),
                    padding .3s cubic-bezier(.4,0,.2,1);
    }
    .tl-narrative-strip.tl-narrative-collapsed {
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }

    /* Vertical feed — legacy (kept for safety, not used) */
    .tl-vlist { display: flex; flex-direction: column; gap: 0; }

    /* Each node: full-width card with colored left bar */
    .tl-vnode { display: block; padding: 0 0 2px 0; }

    .tl-vnode-body {
        display: block;
        background: #fff;
        border: 1px solid var(--border);
        border-bottom: 2px solid var(--border-str);
        border-left: 4px solid var(--border-str);
        padding: 12px 14px 10px;
        cursor: pointer;
        transition: border-color .15s, background .15s;
        position: relative;
        -webkit-tap-highlight-color: transparent;
    }
    .tl-vnode-body:active { background: var(--surface); }
    .tl-vnode-body.active {
        border-left-color: var(--accent);
        background: #fffaf9;
    }
    .tl-vnode-body.dimmed { opacity: .25; pointer-events: none; }

    /* Date + sentiment on one row */
    .tl-vnode-meta {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 6px;
    }
    .tl-vnode-date {
        font-family: var(--mono);
        font-size: 9px;
        font-weight: 800;
        color: var(--dim);
        letter-spacing: .1em;
        text-transform: uppercase;
    }
    .tl-vnode-sent {
        font-family: var(--mono);
        font-size: 8px;
        font-weight: 800;
        letter-spacing: .07em;
        text-transform: uppercase;
        padding: 2px 7px;
    }

    /* Thin sentiment bar across the top of the card */
    .tl-vnode-bar {
        position: absolute;
        top: 0; left: 0; right: 0;
        height: 3px;
    }

    /* Connection arrow between cards */
    .tl-vconn {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 6px 0;
        gap: 8px;
    }
    .tl-vconn-arrow {
        font-family: var(--mono);
        font-size: 9px;
        color: var(--dim);
        letter-spacing: .02em;
    }
    .tl-vconn-lbl {
        font-family: var(--mono);
        font-size: 9px;
        color: var(--dim);
        font-style: italic;
        letter-spacing: .03em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 220px;
        background: var(--surface);
        border: 1px solid var(--border);
        padding: 2px 8px;
    }

    /* Nav arrows hidden on mobile (use swipe/scroll) */
    .tl-nav-arrow { display: none; }

    /* Detail panel: single column on mobile, map stacks below text */
    .tl-detail-cols {
        grid-template-columns: 1fr;
    }
    .tl-detail-map-col {
        position: static;
        height: 220px;
    }
    .tl-detail-map-col .d-map-wrap {
        height: 220px;
    }
    .tl-detail-main { padding: 14px 14px; }

    /* Bigger tap targets */
    .d-headline { font-size: 16px; }
    .d-summary { font-size: 14px; }
    .d-nav-btn { padding: 12px 0; font-size: 11px; }
    /* Mobile card text */
    .nc-headline { font-size: 15px; }
    .nc-summary  { font-size: 13px; }

    /* Bottom sheet handle */
    .tl-left-inner::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
        margin: 0 auto 14px;
    }
}

/* Sidebar overlay — always fixed, never in grid flow */
.tl-sidebar-overlay { display: none; position: fixed; inset: 0; z-index: 399; background: rgba(0,0,0,.3); }

/* ═══════════════════════════════════════
   EMBED MODE
═══════════════════════════════════════ */

/* "↗ Open" link in embed header bar */
.tl-embed-open-btn {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--dim);
    text-decoration: none;
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: 2px;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
}
.tl-embed-open-btn:hover { color: var(--text); border-color: var(--text); text-decoration: none; }

/* Branding footer strip */
.tl-embed-brand {
    display: block;
    text-align: right;
    padding: 3px 12px;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--dim);
    text-decoration: none;
    background: var(--surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.tl-embed-brand:hover { color: var(--text); text-decoration: none; }

/* ═══════════════════════════════════════
   SHARE / EMBED MODAL
═══════════════════════════════════════ */
.tl-share-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .18s;
}
.tl-share-overlay.visible { opacity: 1; }

.tl-share-modal {
    background: #fff;
    border: 2px solid #111;
    border-radius: 4px;
    width: min(640px, 94vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
}

.tl-share-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text);
    flex-shrink: 0;
}
.tl-share-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--dim);
    padding: 0 2px;
    line-height: 1;
}
.tl-share-close:hover { color: var(--text); }

.tl-share-section {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.tl-share-section:last-child { border-bottom: none; }

.tl-share-label {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--dim);
    margin-bottom: 7px;
}
.tl-share-sublabel {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--dim);
    margin-left: 6px;
}

.tl-share-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.tl-share-input {
    flex: 1;
    min-width: 0;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom: 2px solid var(--border-str);
    padding: 6px 8px;
    outline: none;
    cursor: text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tl-share-copy {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    background: #111;
    color: #fff;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 2px;
    white-space: nowrap;
    transition: background .15s;
    flex-shrink: 0;
}
.tl-share-copy:hover { background: #333; }
.tl-share-copy.copied { background: #16a34a; }

.tl-share-preview-label {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--dim);
    margin-top: 12px;
    margin-bottom: 6px;
}
.tl-embed-preview {
    display: block;
    width: 100%;
    height: 380px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
}
