/* Shared sidebar and topic collections, using the application's existing tokens. */
.sb { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 12px; }
.sb > .sb-head, .sb > .nav-item { flex: none; }
.sb .nav-item.on { background: var(--accent-soft); color: var(--accent); }
.sb-history-scroll { flex: 1; min-height: 90px; overflow-y: auto; margin: 7px -3px 4px 0; padding-right: 3px; }
.history-row { display: flex; position: relative; align-items: center; border-radius: 8px; margin: 2px 0; }
.history-row.current { background: var(--accent-soft); }
.history-row.current .history-title { color: var(--accent); }
.history-open { min-width: 0; flex: 1; display: block; text-align: left; border: 0; background: transparent; color: var(--ink-2); padding: 9px 8px; font: inherit; }
.history-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .8rem; line-height: 1.4; }
.history-open small { display: block; color: var(--muted); font-size: .68rem; line-height: 1.4; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row:hover, .history-row:focus-within { background: var(--line-2); }
.history-row.current:hover { background: var(--accent-soft); }
.history-more { align-self: start; margin-top: 8px; flex: none; padding: 0; width: 25px; height: 25px; background: transparent; border: 0; border-radius: 6px; color: var(--ink-2); opacity: 0; font-size: 1rem; }
.history-row:hover .history-more, .history-row:focus-within .history-more { opacity: 1; }
.history-more:hover { background: var(--surface); }
.history-all { display: block; width: 100%; padding: 10px 8px; text-align: left; border: 0; background: transparent; color: var(--accent); font: inherit; font-size: .75rem; }
.sb > .history-all { flex: none; padding-top: 5px; padding-bottom: 7px; }
.history-rename { width: 100%; margin: 5px; padding: 8px; font: inherit; background: var(--surface); color: var(--ink); border: 1px solid var(--accent); border-radius: 6px; }
.sb-topic-links { flex: none; border-top: 1px solid var(--line); padding-top: 2px; }
.sb-topic-links h4 { margin-top: 11px; }
.topic-link { display: block; padding: 7px 9px; color: var(--ink-2); font-size: .82rem; border-radius: 7px; }
.topic-link:hover { background: var(--line-2); text-decoration: none; }
.topic-link.on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.history-actions-menu { position: fixed; z-index: 1200; min-width: 185px; padding: 5px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); }
.history-actions-menu button { display: block; width: 100%; padding: 9px 11px; border: 0; background: transparent; color: inherit; text-align: left; font: inherit; font-size: .8rem; border-radius: 5px; }
.history-actions-menu button:hover, .history-actions-menu button:focus-visible { background: var(--accent-soft); }
.history-dialog { width: min(680px, calc(100vw - 32px)); max-height: 80vh; padding: 24px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.history-dialog::backdrop { background: rgba(15,23,42,.35); }
.history-dialog > header { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 18px; }
.history-dialog h2 { font-size: 1.2rem; }
.history-dialog header p { color: var(--ink-2); font-size: .8rem; margin-top: 4px; }
.history-dialog > input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; }
.history-results { margin-top: 15px; }
.history-group { border-bottom: 1px solid var(--line); padding: 6px 0; }
.history-variants { padding-left: 9px; }
.history-variants summary { color: var(--accent); font-size: .75rem; cursor: pointer; padding: 3px 0 8px; }
.history-variants .history-row { margin-left: 9px; }
.layout-preview { position: relative; margin-left: auto; flex: none; }
.layout-preview > summary { list-style: none; cursor: pointer; color: var(--ink-2); font-size: .74rem; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.layout-preview > summary::after { content: ' ⌄'; }
body.onlanding .layout-preview { display: none; }
.layout-preview #views { display: none !important; }
.layout-preview[open] #views { position: absolute; display: grid !important; right: 0; top: 35px; padding: 6px; min-width: 150px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.layout-preview #views button { width: 100%; height: 34px; text-align: left; padding: 6px 12px; }
.discovery-page .nav #navSlot { justify-content: center; }
.discovery-page #navSlot .search { width: min(600px, 100%); box-shadow: none; }
.discovery-content { max-width: 1180px; margin: 0 auto; padding: 30px 0; }
.topic-back { display: inline-block; font-size: .75rem; color: var(--ink-2); margin-bottom: 12px; }
.topic-intro { margin-bottom: 27px; }
.topic-intro h1 { font-size: clamp(1.5rem, 2.3vw, 2rem); letter-spacing: -.035em; margin-bottom: 9px; }
.topic-intro p { color: var(--ink-2); font-size: .9rem; line-height: 1.7; max-width: 760px; }
.topic-intro, .research-view .research-context {
  padding: 22px 24px;
  border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--line));
  border-radius: 12px;
  background: var(--accent-soft);
}
.research-view:not(.chart-first-view) .research-context { margin-top: 24px; margin-bottom: 20px; }
.bubble-sources { margin-top: 10px; color: var(--ink-2); font-size: .73rem; }
.bubble-sources summary { cursor: pointer; width: fit-content; color: var(--accent); }
.bubble-source-content { margin-top: 10px; border-top: 1px solid color-mix(in srgb, var(--accent) 12%, var(--line)); padding-top: 10px; }
.bubble-source-content a { display: block; width: fit-content; margin: 5px 0; font-size: .73rem; }
.research-context .bubble-source-content p { font-size: .76rem; line-height: 1.6; margin-bottom: 9px; }
@media (max-width: 800px) { .topic-intro, .research-view .research-context { padding: 18px; } }
.topic-directory { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.topic-directory-card { display: flex; flex-direction: column; padding: 23px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; }
.topic-directory-card:hover { text-decoration: none; border-color: var(--accent); }
.topic-directory-card h2 { font-size: 1.05rem; margin-bottom: 8px; }
.topic-directory-card p { color: var(--ink-2); font-size: .82rem; line-height: 1.65; margin-bottom: 18px; }
.topic-directory-card > span { color: var(--accent); font-size: .75rem; margin-top: auto; display: flex; justify-content: space-between; }
.topic-collection-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.topic-collection-header h2 { font-size: 1rem; }
.topic-chart-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
.topic-chart-slot { min-width: 0; }
.topic-chart-card { display: flex; flex-direction: column; height: 100%; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 16px 12px; }
.topic-chart-card:hover { text-decoration: none; border-color: var(--accent); }
.topic-chart-card header { min-height: 67px; }
.topic-chart-card h3, .topic-chart-loading h3, .topic-chart-unavailable h3 { font-size: .88rem; line-height: 1.4; }
.topic-chart-card header p { font-size: .69rem; color: var(--ink-2); margin-top: 5px; }
.topic-preview-canvas { position: relative; height: 205px; margin: 6px 0 14px; }
.topic-chart-card footer { display: flex; flex-wrap: wrap; gap: 7px 12px; border-top: 1px solid var(--line); padding-top: 10px; font-size: .66rem; color: var(--ink-2); }
.topic-chart-card footer span { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; max-width: 100%; }
.topic-chart-card footer b { font-size: .69rem; font-weight: 500; color: var(--accent); margin-left: auto; }
.topic-chart-loading, .topic-chart-unavailable { padding: 22px; min-height: 320px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.topic-chart-loading span, .topic-chart-unavailable p, .discovery-empty { display: block; color: var(--ink-2); font-size: .8rem; margin-top: 15px; }
.topic-coverage { grid-column: 1 / -1; padding: 32px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.topic-coverage h2 { font-size: 1.1rem; }
.topic-coverage p { color: var(--ink-2); margin: 10px 0 18px; font-size: .85rem; }
.demo-format-filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.demo-format-filters .on { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.entity-demo-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px; }
.entity-demo-card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.entity-demo-card[hidden] { display: none; }
.demo-treatment { color: var(--accent); font-size: .7rem; }
.chart-topic-icon { display: inline-block; vertical-align: -.22em; margin-inline-end: .42em; }
.entity-demo-card h2 { font-size: 1.23rem; letter-spacing: -.025em; line-height: 1.3; margin: 7px 0; }
.entity-demo-card header p { font-size: .73rem; color: var(--ink-2); }
.entity-demo-canvas { position: relative; height: 330px; margin: 20px 0 12px; }
.entity-demo-note { font-size: .74rem; color: var(--ink-2); line-height: 1.6; min-height: 38px; }
.entity-demo-card footer { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.entity-demo-card footer > span { font-size: .65rem; color: var(--ink-2); }
.entity-demo-card footer > div { display: flex; gap: 7px; margin-left: auto; }
.entity-demo-card footer button { font-size: .73rem; }
.card.theme-infographic > .head { border-left: 5px solid var(--accent); margin: 18px 20px 0; padding: 0 0 0 16px; }
.card.theme-infographic h2 { font-size: clamp(1.3rem, 2.2vw, 1.85rem); line-height: 1.2; letter-spacing: -.03em; font-weight: 800; white-space: normal; overflow: visible; text-overflow: clip; }
@media (min-width: 1001px) { .chart-first-view .nav #navSlot { width: min(680px, calc(100vw - 700px)); } }
.card.theme-infographic .subtitle { font-size: .93rem; margin-top: 8px; }
.card.theme-infographic .titlerow { height: auto; min-height: 28px; align-items: flex-start; }
.card.theme-infographic .titlerow h2 { flex: 1; }
.card.theme-infographic .titlerow .head-actions { flex: none; }
.card.theme-infographic .cv { border-radius: 8px; overflow: hidden; }
.demos-page.infographic-demos .entity-demo-card h2 { font-size: 1.6rem; font-weight: 800; }
.demos-page.infographic-demos .entity-demo-card header { border-left: 4px solid var(--accent); padding-left: 13px; }
.demo-credits { margin-top: 26px; color: var(--ink-2); font-size: .76rem; line-height: 1.7; }
.demo-credits summary { cursor: pointer; }
.demo-credits p { margin: 10px 0; max-width: 850px; }
@media (max-width: 1200px) { .entity-demo-grid { grid-template-columns: 1fr; } }
@media (max-width: 1200px) { .topic-chart-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-height: 600px) { .sb-topic-links { max-height: 40vh; overflow-y: auto; } }
@media (max-width: 700px) { .topic-chart-grid, .topic-directory { grid-template-columns: 1fr; } .discovery-content { padding-top: 22px; } .discovery-page .nav { flex-wrap: wrap; height: auto; min-height: 58px; padding-bottom: 8px; } .discovery-page #navSlot { order: 10; flex-basis: 100%; } .history-more { opacity: 1; } }
