:root {
  color-scheme: light;
  --ink: #13233a;
  --muted: #627086;
  --line: #dbe3ee;
  --surface: #ffffff;
  --surface-soft: #f4f7fb;
  --accent: #2457d6;
  --accent-soft: #e8efff;
  --danger: #a52a2a;
  --shadow: 0 12px 36px rgba(28, 52, 84, .10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--surface-soft); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.eyebrow { margin: 0; color: var(--accent); font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.header-actions, .inline-actions, .export-actions, .toolbar-groups { display: flex; align-items: center; gap: 8px; }
.cloud-toolbar .export-actions { flex-wrap: wrap; justify-content: flex-end; }
.app-shell { display: grid; grid-template-columns: minmax(250px, 290px) minmax(0, 1fr); min-height: 100vh; align-items: start; }
.sidebar { padding: 18px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.control-section { padding: 0 0 22px; margin: 0 0 22px; border-bottom: 1px solid var(--line); }
.control-section:last-child { border-bottom: 0; }
.control-section h2, .panel h2 { margin: 0 0 14px; font-size: 1rem; }
.field-group { display: grid; gap: 7px; margin: 0 0 14px; }
.field-label { color: var(--ink); font-size: .85rem; font-weight: 700; }
.field-label-row, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.year-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.option-chip { position: relative; }
.option-chip input { position: absolute; opacity: 0; pointer-events: none; }
.option-chip span { display: block; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); text-align: center; font-size: .85rem; }
.option-chip input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.option-chip.locked span::after { content: " 🔒"; font-size: .72em; }
select, input[type="number"], input[type="password"], input[type="search"], input[type="text"], textarea { width: 100%; padding: 9px 10px; border: 1px solid #cbd6e5; border-radius: 9px; background: #fff; color: var(--ink); }
textarea { resize: vertical; min-height: 92px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.toggle-row { display: flex; gap: 9px; align-items: center; margin: 10px 0; font-size: .9rem; }
.toggle-row input { accent-color: var(--accent); }
.help, .muted { color: var(--muted); font-size: .84rem; line-height: 1.45; }
.button, .icon-button { border: 0; border-radius: 9px; background: var(--accent); color: white; font-weight: 700; padding: 10px 14px; }
.button.secondary, .icon-button { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.button.small { padding: 7px 10px; font-size: .82rem; }
.text-button { border: 0; background: transparent; color: var(--accent); padding: 2px; font-size: .8rem; font-weight: 700; }
.workspace { padding: 22px; min-width: 0; }
.status-strip { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 12px; color: var(--muted); font-size: .88rem; }
.status-strip strong { color: var(--ink); margin-right: 8px; }
.cloud-card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.cloud-toolbar { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.segmented button { border: 0; background: #fff; color: var(--muted); padding: 8px 12px; font-weight: 700; }
.segmented button.active { background: var(--accent-soft); color: var(--accent); }
.display-count-status { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.timeline-controls { display: grid; grid-template-columns: 36px auto 36px minmax(220px, 1fr) 112px 150px; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); width: 100%; }
.timeline-controls select { width: 100%; min-width: 0; }
#timelineLabel { width: 112px; text-align: center; white-space: nowrap; }
#timelineSlider { min-width: 0; }
.visual-viewport { height: clamp(500px, 66vh, 760px); position: relative; overflow: auto; touch-action: auto; background: radial-gradient(circle at 50% 45%, #fff 0, #fff 62%, #f7f9fc 100%); border-radius: 0 0 16px 16px; }
#visualSvg { width: 100%; min-height: 100%; display: block; user-select: none; }
.cloud-word { cursor: pointer; dominant-baseline: middle; text-anchor: middle; font-weight: 700; font-family: "Segoe UI", Arial, sans-serif; }
.visual-viewport.cloud-interactive .cloud-word { cursor: pointer; }
.visual-viewport.cloud-interactive.dragging .cloud-word { cursor: grabbing; }
.cloud-word:hover, .cloud-word:focus, .bar-label:hover, .bar-label:focus { fill: var(--accent); outline: none; }
.bar-row { cursor: pointer; }
.bar-label { fill: var(--ink); font-size: 13px; dominant-baseline: middle; font-family: "Segoe UI", Arial, sans-serif; }
.bar-value { fill: var(--ink); font-size: 12px; font-weight: 700; dominant-baseline: middle; font-family: "Segoe UI", Arial, sans-serif; }
.bar-track { fill: #edf2f8; }
.bar-fill { fill: var(--accent); }
.bar-row:hover .bar-fill, .bar-row:focus .bar-fill { opacity: .78; }
.empty-state { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; }
.explore-layout { width: min(100%, 1380px); margin: 0 auto; display: grid; grid-template-columns: minmax(520px, 1fr) minmax(340px, 390px); gap: 16px; align-items: start; }
.cloud-card { min-width: 0; }
.insight-column { min-width: 0; display: grid; gap: 16px; align-content: start; }
.panel { padding: 16px; min-height: 150px; box-shadow: none; }
.item-details strong { color: var(--ink); }
.detail-title { font-size: 1.35rem; font-weight: 800; margin-bottom: 8px; }
.detail-stats { display: flex; gap: 18px; flex-wrap: wrap; margin: 10px 0; }
.detail-stat { background: var(--surface-soft); border-radius: 10px; padding: 9px 12px; }
.detail-stat b { display: block; font-size: 1.1rem; }
.time-series-wrap { position: relative; min-height: 210px; }
#timeSeriesSvg { width: 100%; height: 220px; display: block; }
.time-series-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .86rem; }
.series-axis { stroke: #bcc8d8; stroke-width: 1; }
.series-grid { stroke: #e7edf5; stroke-width: 1; }
.series-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.series-area { fill: rgba(36, 87, 214, .08); }
.series-point { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.series-label { fill: var(--muted); font-size: 10px; }
.hidden { display: none !important; }
.error-message { color: var(--danger); min-height: 1.3em; }
dialog { border: 0; padding: 0; border-radius: 16px; box-shadow: 0 24px 80px rgba(15, 33, 60, .28); }
dialog::backdrop { background: rgba(22, 34, 53, .42); backdrop-filter: blur(2px); }
.dialog-card { width: min(430px, calc(100vw - 32px)); padding: 26px; position: relative; }
.dialog-card h2 { margin: 6px 0 10px; }
.dialog-close { position: absolute; right: 12px; top: 10px; border: 0; background: transparent; font-size: 1.6rem; color: var(--muted); }
.mobile-only { display: none; }
.page-tabs { margin-right: 4px; }
.search-page { display: grid; gap: 16px; }
.search-controls-panel { padding: 18px; scroll-margin-top: 12px; }
.search-controls-panel h2 { margin-top: 4px; }
.search-form { display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 12px; align-items: end; }
.search-query-field { display: grid; gap: 7px; }
.search-submit { min-height: 40px; }
.search-options { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 12px; }
.search-grid { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); gap: 16px; }
.search-results { display: grid; gap: 8px; }
.search-result { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 14px; text-align: left; }
.search-result span { display: grid; gap: 3px; }
.search-result small { color: var(--muted); }
.search-result.active { border-color: var(--accent); background: var(--accent-soft); }
.search-result > b { color: var(--accent); white-space: nowrap; }
.search-match-forms { columns: 2; column-gap: 28px; }
.search-series-panel { min-height: 280px; }
#searchSeriesSvg { width: 100%; height: 220px; display: block; }
@media (max-width: 900px) {
  .page-tabs { order: 3; width: 100%; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .search-form, .search-grid { grid-template-columns: 1fr; }
  .search-match-forms { columns: 1; }
}

.combined-forms { padding-left: 0; list-style: none; display: grid; gap: 6px; }
.combined-form { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.combined-form:last-child { border-bottom: 0; }
.visual-viewport { overflow: auto; }

.visual-viewport.cloud-interactive { cursor: grab; overflow: hidden; touch-action: none; }
.visual-viewport.cloud-interactive.dragging { cursor: grabbing; }
.visual-loading { position: absolute; inset: 12px 12px auto auto; z-index: 4; padding: 7px 10px; border-radius: 999px; background: rgba(255,255,255,.94); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--accent); font-size: .78rem; font-weight: 700; pointer-events: none; display: inline-flex; align-items: center; gap: 7px; }
.cloud-interaction-hint { position: absolute; left: 12px; bottom: 10px; z-index: 3; padding: 5px 8px; border-radius: 7px; color: var(--muted); background: rgba(255,255,255,.86); font-size: .72rem; pointer-events: none; opacity: .82; }
.cloud-card:fullscreen { background: var(--surface); padding: 0; border: 0; border-radius: 0; }
.cloud-card:fullscreen .visual-viewport { height: calc(100vh - 118px); border-radius: 0; }
.cloud-card:fullscreen .cloud-toolbar { border-radius: 0; }


/* Stage 2.7 interface refinements */
.whitelist-group { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.button.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }

.is-loading::before {
  content: "";
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: pwc-spin .75s linear infinite;
}
@keyframes pwc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .is-loading::before { animation-duration: 1.6s; }
}

.search-form input[type="search"] {
  min-height: 40px;
  border-color: #cbd6e5;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  appearance: none;
  -webkit-appearance: none;
}
.search-form input[type="search"]:focus,
.search-form select:focus,
select:focus,
textarea:focus,
input:focus {
  outline: 2px solid rgba(36, 87, 214, .18);
  outline-offset: 1px;
  border-color: var(--accent);
}

.export-dialog-card { width: min(520px, calc(100vw - 32px)); }
.export-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.export-choice { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 18px; display: grid; gap: 5px; text-align: left; }
.export-choice:hover, .export-choice:focus { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.export-choice strong { color: var(--accent); font-size: 1rem; }
.export-choice span { color: var(--muted); font-size: .82rem; line-height: 1.35; }
.export-choice:disabled { opacity: .55; cursor: wait; }
.export-status { min-height: 1.5em; margin: 14px 0 0; display: inline-flex; align-items: center; gap: 7px; }

@media (max-width: 980px) {
  .timeline-controls { grid-template-columns: 36px auto 36px minmax(160px, 1fr); }
  #timelineLabel { width: auto; text-align: left; }
}
@media (max-width: 520px) {
  .export-choice-grid { grid-template-columns: 1fr; }
}


/* Stage 2.7 integrated analysis, first-paint preview and balanced insight column */
.explore-layout { align-items: stretch; }
.cloud-card { display: flex; flex-direction: column; }
.cloud-card .visual-viewport { flex: 1 1 auto; }
.insight-column { height: 100%; grid-template-rows: minmax(170px, .38fr) minmax(300px, .62fr); }
.insight-column > .panel { min-height: 0; height: 100%; }
.selected-item-panel { display: flex; flex-direction: column; overflow: hidden; }
.selected-item-panel #itemDetails { min-height: 0; overflow: auto; padding-right: 5px; overscroll-behavior: contain; }
.time-series-panel { overflow: hidden; }
.integrated-search { margin-top: 18px; padding-top: 2px; }
.page-tabs { display: none !important; }

#playPause { width: 72px; min-width: 72px; justify-content: center; }
#playPause.is-loading { display: inline-flex; align-items: center; gap: 0; }
#playPause.is-loading::before {
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  flex-basis: 14px;
  border-color: rgba(255,255,255,.42);
  border-top-color: #fff;
  border-right-color: #fff;
}


@media (max-width: 1180px) {
  .insight-column { height: auto; grid-template-rows: none; }
  .selected-item-panel #itemDetails { max-height: 320px; }
}

/* Stage 2.9 consolidation: central loading, balanced insights and compact timeline controls */
.visual-loading,


.insight-column {
  grid-template-rows: repeat(2, minmax(0, 1fr));
}
.selected-item-panel,
.time-series-panel {
  min-height: 0;
  height: 100%;
}
.time-series-panel {
  display: flex;
  flex-direction: column;
}
.time-series-panel .time-series-wrap {
  min-height: 0;
  flex: 1 1 auto;
}
#timeSeriesSvg,
#searchSeriesSvg {
  height: 258px;
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  line-height: 1;
}
.icon-button > span {
  display: block;
  width: 1em;
  text-align: center;
  transform: translateX(0);
}

.timeline-controls {
  grid-template-columns: 36px auto 36px minmax(220px, 1fr) 132px 118px;
}
#timelineLabel {
  width: 132px;
}
#timelineAggregation {
  width: 118px;
}

.button-spinner {
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 2px solid rgba(255,255,255,.42);
  border-top-color: #fff;
  border-right-color: #fff;
  border-radius: 50%;
  animation: pwc-spin .75s linear infinite;
}
#playPause.is-loading::before { display: none !important; content: none !important; }
#playPause.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.search-analysis-results {
  display: grid;
  gap: 16px;
}
.series-label-vertical {
  dominant-baseline: central;
}

@media (max-width: 1180px) {
  .insight-column { grid-template-rows: none; }
}
@media (max-width: 980px) {
  .timeline-controls { grid-template-columns: 36px auto 36px minmax(150px, 1fr); }
  #timelineLabel, #timelineAggregation { width: auto; }
}

/* Stage 2.9: clearer controls, reliable status spinners and fixed insight sizing */
.sidebar-scope-note {
  display: grid;
  gap: 4px;
  margin: -4px 0 22px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.sidebar-scope-note strong { font-size: .9rem; color: var(--ink); }
.sidebar-scope-note span { color: var(--muted); font-size: .78rem; line-height: 1.4; }
.control-subheading { margin: 0 0 8px; font-size: .9rem; }
.exclusions-actions { margin-top: 14px; }

.status-spinner {
  display: inline-block;
  box-sizing: border-box;
  width: 13px;
  height: 13px;
  min-width: 13px;
  min-height: 13px;
  flex: 0 0 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: pwc-spin .75s linear infinite;
}
.export-status,
#searchStatus.is-loading {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
#timeSeriesSummary.is-loading {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
#searchStatus.is-loading::before,
#timeSeriesSummary.is-loading::before,
.export-status.is-loading::before {
  display: none !important;
  content: none !important;
}

.explore-layout { align-items: stretch; }
.insight-column {
  align-self: stretch;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: repeat(2, minmax(0, 1fr));
}
.insight-column > .panel {
  min-height: 0;
  overflow: hidden;
}
.selected-item-panel #itemDetails {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.selected-item-panel #itemDetails.muted {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
}
.time-series-panel .time-series-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
#timeSeriesSvg { height: 100%; min-height: 190px; }

.cloud-word-reveal {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  transform: scale(.72);
  transition: opacity .34s ease, transform .34s ease;
}
.cloud-word-reveal.revealed {
  opacity: 1;
  transform: scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .status-spinner { animation-duration: 1.6s; }
  .cloud-word-reveal { transition-duration: .01ms; }
}

.nonword-help { display: block; margin: -4px 0 14px 27px; }

/* Stage 2.10.3: persistent page controls and modal visualisation settings */
:root {
  --analysis-card-height: clamp(640px, calc(66vh + 76px), 840px);
}

.workspace {
  padding: 22px;
  min-width: 0;
}
.status-strip,
.explore-layout,
.integrated-search {
  width: min(100%, 1450px);
  margin-left: auto;
  margin-right: auto;
}
.sidebar.page-controls {
  position: sticky;
  top: 0;
  align-self: start;
  width: auto;
  height: 100vh;
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 18px rgba(31, 55, 86, .05);
}
.paper-filter-heading,
.toggle-with-tooltip,
.control-subheading-row,
.visualisation-toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.paper-filter-heading {
  position: sticky;
  top: -18px;
  z-index: 2;
  margin: -18px -18px 16px;
  padding: 17px 18px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.paper-filter-heading h2 { margin: 0; }
.page-control-section {
  padding: 0 0 18px;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--line);
}
.page-control-section:last-child {
  margin-bottom: 0;
  padding-bottom: 4px;
  border-bottom: 0;
}
.paper-filter-grid,
.analysis-controls-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.paper-filter-group,
.shared-analysis-control {
  min-width: 0;
  margin: 0;
}
.page-controls .check-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.page-controls #paperOptions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.page-controls #paperOptions .option-chip span {
  padding-inline: 5px;
}
.page-controls .year-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.page-controls .option-chip span {
  padding: 7px 8px;
}
.shared-analysis-toggle {
  min-height: 40px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.explore-layout {
  grid-template-columns: minmax(520px, 1fr) minmax(330px, 390px);
  align-items: stretch;
}
.cloud-card,
.insight-column {
  height: var(--analysis-card-height);
  min-height: 0;
}
.cloud-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cloud-card .visual-viewport {
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
}
.insight-column {
  align-self: stretch;
  grid-template-rows: repeat(2, minmax(0, 1fr));
}
.visualisation-toolbar-group { flex-wrap: nowrap; }
#visualSettings { white-space: nowrap; }
.timeline-video-settings { margin-top: 0; padding-top: 0; padding-bottom: 4px; margin-bottom: 0; border-top: 0; border-bottom: 0; }
.timeline-video-settings h3 { margin: 0 0 4px; }
.timeline-video-settings .field-group { margin-top: 14px; }

.visual-settings-dialog-card {
  width: min(520px, calc(100vw - 32px));
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.visual-settings-dialog-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 5px 0 0;
}
.visual-only-controls {
  display: grid;
  gap: 4px;
}
.visual-settings-dialog-content .control-section:last-of-type {
  margin-bottom: 14px;
}
.visual-settings-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 2px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.info-tooltip {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 1px solid #b9c7da;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface);
  font-size: .7rem;
  font-weight: 800;
  font-style: normal;
  line-height: 1;
  cursor: help;
}
.info-tooltip:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.toggle-with-tooltip {
  justify-content: space-between;
  margin: 2px 0;
}
.toggle-with-tooltip .toggle-row {
  margin-right: 0;
}
.control-subheading-row {
  justify-content: space-between;
  margin-bottom: 8px;
}
.control-subheading-row .control-subheading {
  margin: 0;
}
.nonword-help,
.sidebar-scope-note {
  display: none !important;
}

.search-statistics-panel {
  min-height: 0;
}
.search-match-selector {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.search-results {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.search-result {
  width: auto;
  min-width: 170px;
  max-width: 100%;
  border-radius: 999px;
  padding: 8px 12px;
  gap: 10px;
}
.search-result span {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.search-result small {
  overflow: hidden;
  max-width: 230px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.search-grid {
  display: block;
}

@media (max-width: 1420px) {
  .app-shell { grid-template-columns: minmax(240px, 270px) minmax(0, 1fr); }
  .explore-layout { grid-template-columns: minmax(500px, 1fr) minmax(310px, 350px); }
}
@media (max-width: 1180px) {
  :root { --analysis-card-height: auto; }
  .explore-layout { grid-template-columns: 1fr; }
  .cloud-card,
  .insight-column { height: auto; }
  .cloud-card .visual-viewport { height: clamp(500px, 66vh, 760px); }
  .insight-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
  }
}
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar.page-controls {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    width: min(360px, 92vw);
    height: 100vh;
    max-height: none;
    transform: translateX(-105%);
    transition: transform .25s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.page-controls.open { transform: translateX(0); }
  .mobile-only { display: inline-flex; }
  .workspace { padding: 16px; }
  .timeline-controls { grid-template-columns: auto auto auto 1fr; }
  .timeline-controls strong,
  .timeline-controls select { grid-column: span 2; }
}
@media (max-width: 760px) {
  .insight-column { grid-template-columns: 1fr; }
  .search-result { width: 100%; border-radius: 10px; }
}
@media (max-width: 700px) {
  .cloud-toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-groups,
  .export-actions { justify-content: space-between; flex-wrap: wrap; }
}
@media (max-width: 620px) {
  .workspace { padding: 10px; }
  .export-actions .button { flex: 1; }
  .visual-viewport { height: 58vh; min-height: 420px; }
  .status-strip { align-items: flex-start; flex-direction: column; gap: 4px; }
  .display-count-status { width: 100%; }
  .visualisation-toolbar-group { width: 100%; }
  .visualisation-toolbar-group .segmented { flex: 1; }
  .visualisation-toolbar-group .segmented button { flex: 1; }
}

/* Stage 2.9.10 preview, search variants and video settings */
.search-match-forms {
  columns: auto;
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 8px 12px;
}
.search-match-form {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(3.5ch, auto) 72px;
  align-items: center;
  gap: 9px;
  padding: 7px 8px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  break-inside: avoid;
}
.search-match-form-label { min-width: 0; overflow-wrap: anywhere; }
.search-match-form-count { min-width: 3.5ch; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.search-match-form.is-excluded { background: var(--surface-soft); color: var(--muted); }
.search-match-form.is-excluded .search-match-form-label { text-decoration: line-through; }
.search-form-toggle { width: 72px; justify-content: center; padding: 5px 7px; font-size: .74rem; }
.dialog-actions { justify-content: flex-end; margin-top: 20px; }
#exportAnimation[disabled] { opacity: .55; cursor: not-allowed; }
@media (max-width: 980px) {
  .search-match-forms { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
}


/* Stage 2.9.10 native help, progressive clouds and wider search tiles */
.cloud-word.cloud-transitioning {
  transform-box: fill-box;
  transform-origin: center;
  will-change: transform, opacity;
}
.cloud-word.progressive-new-word {
  opacity: 0;
}
.series-label-vertical {
  font-size: 9px;
}
@media (min-width: 1500px) {
  .search-match-forms { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
}

/* Stage 2.10 loading affordance and question-aware measures */
.cloud-generating {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--accent);
  font-weight: 700;
  background: #fff;
  pointer-events: none;
}
.cloud-generating.hidden { display: none; }
.cloud-generating .spinner { width: 18px; height: 18px; }
.cloud-generating .spinner.hidden { display: none; }
.measure-warning { margin: 7px 0 0; }
.control-section > .field-group:first-child { margin-top: 0; }

/* Stage 2.10.4: headerless shell and page-wide analysis controls */
.page-control-heading {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: .92rem;
}
.paper-filter-heading { justify-content: space-between; }
.paper-filter-heading h2 {
  font-size: 1.08rem;
  line-height: 1.25;
}
.filters-close.mobile-only { display: none; }
.filters-close {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 1.35rem;
}
.shared-content-controls .toggle-row { margin: 8px 0; }
.custom-filter-controls textarea { min-height: 78px; }
.whitelist-group { margin-top: 18px; }
.sidebar-reset { width: 100%; margin: 0 0 8px; }
.mobile-filter-bar { display: none; }
.visual-only-controls .field-group:last-child { margin-bottom: 0; }
.visual-settings-footer { justify-content: flex-end; }

@media (max-width: 980px) {
  .mobile-filter-bar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    justify-content: flex-start;
    margin: -16px -16px 14px;
    padding: 10px 16px;
    background: rgba(244, 247, 251, .96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(8px);
  }
  .filters-close.mobile-only { display: inline-grid; }
}

@media (max-width: 620px) {
  .mobile-filter-bar { margin: -10px -10px 10px; padding: 9px 10px; }
}


/* Stage 2.10.8: tighter workspace and selection controls */
.selected-item-panel > .panel-heading { flex: 0 0 auto; margin-bottom: 8px; }
.selected-item-panel > .panel-heading h2 { margin: 0; }
#clearSelectedItem:disabled { opacity: .48; cursor: default; }

/* Stage 2.11.2: unified Search/Compare workspace and relative comparison scales */
.search-page {
  padding-bottom: 96px;
}
.analysis-tools-panel {
  padding: 18px;
  scroll-margin-top: 12px;
}
.analysis-tool-tabs {
  width: fit-content;
  margin-bottom: 16px;
}
.analysis-tool-tabs button {
  min-width: 104px;
}
.analysis-tool-pane {
  min-width: 0;
}
.analysis-tool-form {
  display: grid;
  gap: 12px;
}
.analysis-tool-form-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1.8fr) minmax(250px, 1fr);
  gap: 14px;
  align-items: end;
}
.analysis-tool-form-grid > .field-group,
.analysis-tool-option-box {
  margin: 0;
}
.analysis-tool-option-box {
  display: grid;
  align-content: center;
  gap: 9px;
  min-height: 64px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}
.analysis-tool-option-box .toggle-row {
  margin: 0;
}
.analysis-tool-actions {
  display: flex;
  justify-content: flex-end;
}
.search-submit,
.comparison-submit,
.dialog-submit {
  min-width: 104px;
}
.analysis-tool-pane > .help {
  margin-bottom: 0;
}
.comparison-query-field textarea,
.comparison-query-field input[type="text"] {
  height: 46px;
  min-height: 46px;
  max-height: 46px;
  resize: none;
  border-color: #cbd6e5;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}
.comparison-query-row {
  grid-template-columns: minmax(0, 1fr);
}
.comparison-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}
.comparison-action-row .comparison-grouping-field {
  margin: 0;
}
.comparison-action-row .comparison-submit {
  min-height: 40px;
}
.comparison-results-panel {
  padding: 18px;
}
.comparison-summary {
  margin: -7px 0 0;
}
.comparison-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin: 16px 0 14px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}
.comparison-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.comparison-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--accent);
}
.comparison-swatch.group-2 {
  background: #18747b;
}
.comparison-chart {
  display: grid;
  gap: 14px;
}
.comparison-term-row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.comparison-term-row:first-child {
  border-top: 0;
  padding-top: 2px;
}
.comparison-term-row h3 {
  margin: 0;
  font-size: .96rem;
  overflow-wrap: anywhere;
}
.comparison-term-bars {
  display: grid;
  gap: 8px;
}
.comparison-bar-line {
  display: grid;
  grid-template-columns: minmax(92px, 132px) minmax(90px, 1fr) minmax(64px, auto);
  gap: 10px;
  align-items: center;
  min-width: 0;
}
.comparison-bar-line.single-group {
  grid-template-columns: minmax(90px, 1fr) minmax(64px, auto);
}
.comparison-group-label {
  color: var(--muted);
  font-size: .78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.comparison-bar-track {
  display: block;
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f8;
}
.comparison-bar-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--comparison-colour, var(--accent));
  transform: scaleX(var(--comparison-ratio, 0));
  transform-origin: left center;
}
.comparison-bar-line strong {
  text-align: right;
  color: var(--ink);
  font-size: .84rem;
  white-space: nowrap;
}
#loginForm {
  display: grid;
}
.dialog-submit {
  justify-self: end;
}
.comparison-series-heading {
  margin-bottom: 8px;
}
.comparison-series-heading h3 {
  margin: 0;
  font-size: 1rem;
}
.comparison-series-wrap {
  position: relative;
  min-height: 300px;
}
#comparisonSeriesSvg {
  display: block;
  width: 100%;
  height: 310px;
}
.comparison-series-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 22px;
  margin: 8px 0 4px;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 700;
}
.comparison-series-legend-set {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 16px;
}
.comparison-series-legend-set > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.comparison-series-colour {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}
.comparison-series-style {
  width: 24px;
  height: 0;
  border-top: 3px solid var(--muted);
}
.comparison-series-style.dashed {
  border-top-style: dashed;
}
.comparison-series-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.comparison-series-point {
  stroke: var(--surface);
  stroke-width: 1.5;
}
@media (max-width: 900px) {
  .analysis-tool-form-grid,
  .comparison-term-row {
    grid-template-columns: 1fr;
  }
  .analysis-tool-option-box {
    min-height: auto;
  }
}
@media (max-width: 620px) {
  .analysis-tool-tabs {
    width: 100%;
  }
  .analysis-tool-tabs button {
    flex: 1;
  }
  .comparison-bar-line {
    grid-template-columns: minmax(78px, 108px) minmax(72px, 1fr) minmax(58px, auto);
  }
  .comparison-bar-line.single-group {
    grid-template-columns: minmax(72px, 1fr) minmax(58px, auto);
  }
}


/* Stage 2.11.3: shared analysis header and side-by-side controls/results */
.analysis-workspace-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.analysis-output-column {
  min-width: 0;
}
.analysis-tools-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.analysis-tools-heading-row .analysis-tool-tabs {
  flex: 0 0 auto;
  margin-bottom: 0;
}
.analysis-related-toggle {
  margin: 0;
  text-align: right;
}
.search-form .analysis-tool-form-grid {
  grid-template-columns: minmax(0, 1fr);
}
.analysis-output-column > .panel,
.analysis-output-column > .search-analysis-results {
  width: 100%;
}
@media (max-width: 1100px) {
  .analysis-workspace-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .analysis-tools-heading-row {
    align-items: stretch;
    flex-direction: column;
  }
  .analysis-related-toggle { text-align: left; }
}
.analysis-workspace-grid {
  min-height: calc(100vh - 28px);
}


/* Stage 2.11.4: fixed analysis cards, local series loading and compact comparison controls */
.analysis-input-column {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.analysis-output-column {
  min-width: 0;
}
.analysis-series-panel {
  min-height: 360px;
  padding: 18px;
}
.analysis-series-view {
  min-width: 0;
}
.analysis-series-wrap {
  min-height: 300px;
}
.analysis-results-placeholder {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fbfcfe;
}
.search-statistics-panel,
.comparison-results-panel {
  min-height: 360px;
}
.search-statistics-panel > h2 {
  margin-top: 0;
}
@media (max-width: 700px) {
  .comparison-action-row {
    grid-template-columns: 1fr;
  }
  .comparison-action-row .comparison-submit {
    justify-self: end;
  }
}

/* Stage 2.11.5: one sticky insight set for visual selection, Search and Compare */
.unified-insights-layout {
  align-items: start;
}
.activity-column {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.activity-column > .cloud-card {
  height: var(--analysis-card-height);
}
.shared-insight-column {
  position: sticky;
  top: 12px;
  align-self: start;
  height: calc(100vh - 24px);
  max-height: calc(100vh - 24px);
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  grid-template-rows: minmax(280px, 1fr) minmax(300px, .9fr);
}
.shared-insight-column > .panel {
  height: auto;
  min-height: 0;
}
.shared-statistics-panel,
.shared-series-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.shared-statistics-panel .insight-view {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}
.shared-statistics-panel #itemDetails,
.shared-statistics-panel #searchDetails {
  max-height: none;
}
.shared-series-panel .analysis-series-view {
  flex: 1 1 auto;
  min-height: 0;
}
.shared-series-panel .analysis-series-wrap {
  min-height: 250px;
  height: 100%;
}
.shared-series-panel #timeSeriesSvg,
.shared-series-panel #searchSeriesSvg,
.shared-series-panel #comparisonSeriesSvg {
  width: 100%;
  height: 100%;
  min-height: 250px;
}
.shared-statistics-panel .analysis-results-placeholder {
  min-height: 210px;
}
.integrated-search {
  margin-top: 0;
  padding-bottom: 96px;
}
.analysis-workspace-grid {
  display: block;
  min-height: 0;
}
.analysis-output-column,
.analysis-input-column > .analysis-series-panel {
  display: none !important;
}
.comparison-summary {
  display: none !important;
}

.comparison-bar-progress {
  display: block;
  width: 100%;
  height: 13px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  background: #edf2f8;
}
.comparison-bar-progress::-webkit-progress-bar {
  background: #edf2f8;
  border-radius: 999px;
}
.comparison-bar-progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 999px;
}
.comparison-bar-progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 999px;
}
.comparison-bar-progress.group-colour-2::-webkit-progress-value { background: #18747b; }
.comparison-bar-progress.group-colour-2::-moz-progress-bar { background: #18747b; }
.comparison-bar-progress.term-colour-0::-webkit-progress-value { background: #173f8a; }
.comparison-bar-progress.term-colour-0::-moz-progress-bar { background: #173f8a; }
.comparison-bar-progress.term-colour-1::-webkit-progress-value { background: #2457d6; }
.comparison-bar-progress.term-colour-1::-moz-progress-bar { background: #2457d6; }
.comparison-bar-progress.term-colour-2::-webkit-progress-value { background: #3972d9; }
.comparison-bar-progress.term-colour-2::-moz-progress-bar { background: #3972d9; }
.comparison-bar-progress.term-colour-3::-webkit-progress-value { background: #4d5f86; }
.comparison-bar-progress.term-colour-3::-moz-progress-bar { background: #4d5f86; }
.comparison-bar-progress.term-colour-4::-webkit-progress-value { background: #186b72; }
.comparison-bar-progress.term-colour-4::-moz-progress-bar { background: #186b72; }
.comparison-bar-progress.term-colour-5::-webkit-progress-value { background: #7a4a8a; }
.comparison-bar-progress.term-colour-5::-moz-progress-bar { background: #7a4a8a; }
.comparison-bar-progress.term-colour-6::-webkit-progress-value { background: #865a2c; }
.comparison-bar-progress.term-colour-6::-moz-progress-bar { background: #865a2c; }

@media (max-width: 1180px) {
  .shared-insight-column {
    position: static;
    height: auto;
    max-height: none;
    overflow: visible;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
  }
  .shared-insight-column > .panel {
    min-height: 360px;
  }
}
@media (max-width: 760px) {
  .shared-insight-column {
    grid-template-columns: 1fr;
  }
}

/* Leave enough trailing space for Search/Compare submissions to align the card at the top. */
.activity-column > .integrated-search {
  padding-bottom: max(96px, calc(100vh - 300px));
}
.activity-column > .integrated-search {
  padding-bottom: max(96px, calc(100vh - 200px));
}
.shared-statistics-panel .comparison-term-row {
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: stretch;
}
.shared-statistics-panel .comparison-bar-line {
  grid-template-columns: minmax(80px, 110px) minmax(60px, 1fr) auto;
}
.shared-statistics-panel .comparison-bar-line.single-group {
  grid-template-columns: minmax(60px, 1fr) auto;
}
.shared-statistics-panel .comparison-bar-line strong {
  min-width: 3.5em;
  padding-right: 2px;
}


/* Stage 2.11.6: compact activity column and full-height right insight sidebar */
:root {
  --analysis-card-height: clamp(360px, calc(100vh - 330px), 520px);
  --right-insight-width: 506px;
}

.app-shell {
  grid-template-columns: minmax(250px, 290px) minmax(560px, 1fr) var(--right-insight-width);
  align-items: start;
}

.workspace {
  width: 100%;
  max-width: 1060px;
  justify-self: center;
  padding: 16px 18px 0;
}

.explore-layout,
.unified-insights-layout {
  width: 100%;
  max-width: none;
  display: block;
  margin: 0;
}

.activity-column {
  gap: 14px;
  padding-bottom: 18px;
}

.activity-column > .cloud-card {
  height: var(--analysis-card-height);
}

.activity-column > .integrated-search,
.integrated-search {
  margin: 0;
  padding: 0 0 18px;
}

.shared-insight-column {
  grid-column: 3;
  grid-row: 1;
  position: sticky;
  top: 0;
  align-self: start;
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(260px, 1fr) minmax(280px, 1fr);
  gap: 0;
  padding: 18px;
  overflow: hidden;
  overscroll-behavior: contain;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 18px rgba(31, 55, 86, .05);
}

.shared-insight-column > .panel {
  height: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.shared-statistics-panel {
  padding-bottom: 16px !important;
  border-bottom: 1px solid var(--line) !important;
}

.shared-series-panel {
  padding-top: 16px !important;
}

.shared-statistics-panel .insight-view,
.shared-series-panel .analysis-series-view {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.shared-series-panel .analysis-series-wrap,
.shared-series-panel #timeSeriesSvg,
.shared-series-panel #searchSeriesSvg,
.shared-series-panel #comparisonSeriesSvg {
  min-height: 220px;
}

@media (max-width: 1320px) {
  .app-shell {
    grid-template-columns: minmax(240px, 270px) minmax(0, 1fr);
  }
  .workspace {
    max-width: none;
  }
  .shared-insight-column {
    grid-column: 2;
    grid-row: auto;
    position: static;
    height: auto;
    max-height: none;
    min-height: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    gap: 16px;
    padding: 18px;
    overflow: visible;
    border-top: 1px solid var(--line);
    border-left: 0;
    box-shadow: none;
  }
  .shared-insight-column > .panel {
    min-height: 340px;
    padding: 16px !important;
    border: 1px solid var(--line) !important;
    border-radius: 16px;
    background: var(--surface);
  }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .shared-insight-column {
    grid-column: 1;
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .workspace { padding: 16px; }
  .activity-column > .cloud-card {
    height: auto;
  }
  .cloud-card .visual-viewport {
    height: clamp(430px, 58vh, 620px);
  }
}


/* Stage 2.11.7: shared analysis tables and compact comparison input mode */
.analysis-heading-options {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  flex-wrap: wrap;
}

.metrics-table-wrap {
  width: 100%;
  margin: 12px 0 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
}

.metrics-table th,
.metrics-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

.metrics-table thead th {
  background: var(--surface-soft);
  font-weight: 700;
}

.metrics-table th:first-child,
.metrics-table td:first-child {
  text-align: left;
  white-space: normal;
}

.metrics-table tbody tr:last-child th,
.metrics-table tbody tr:last-child td {
  border-bottom: 0;
}

.forms-table-wrap {
  max-height: 290px;
  overflow: auto;
}

.forms-table th:first-child { min-width: 130px; }
.metric-table-action { width: 1%; }
.detail-subheading { margin: 18px 0 8px; font-size: .95rem; }
.detail-metadata { margin: 10px 0; }
.detail-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.comparison-bars-section { margin-top: 18px; }

@media (max-width: 720px) {
  .analysis-heading-options {
    width: 100%;
    justify-content: flex-start;
    gap: 10px 16px;
  }
  .metrics-table { font-size: .84rem; }
  .metrics-table th, .metrics-table td { padding: 7px 8px; }
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}


/* Stage 2.11.7 r2: compact paper filters and opt-in cloud navigation */
#panZoomToggle.active,
#panZoomToggle[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Stage 2.11.9: one continuous insight sidebar and table-only comparisons */
.shared-insight-column.panel {
  display: block;
  height: 100vh;
  max-height: 100vh;
  padding: 18px;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  box-shadow: -8px 0 18px rgba(31, 55, 86, .05);
  overscroll-behavior: contain;
}

.shared-insight-column > .shared-statistics-panel,
.shared-insight-column > .shared-series-panel {
  min-height: 0;
  height: auto;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.shared-insight-column > .shared-statistics-panel {
  padding-bottom: 18px !important;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line) !important;
}

.shared-statistics-panel .insight-view,
.shared-series-panel .analysis-series-view {
  min-height: 0;
  overflow: visible;
}

.shared-series-panel .analysis-series-wrap,
.shared-series-panel #timeSeriesSvg,
.shared-series-panel #searchSeriesSvg,
.shared-series-panel #comparisonSeriesSvg {
  min-height: 240px;
}

.comparison-bars-section,
.comparison-legend {
  display: none !important;
}

@media (max-width: 1320px) {
  .shared-insight-column.panel {
    grid-column: 2;
    grid-row: auto;
    position: static;
    height: auto;
    max-height: none;
    margin: 0 18px 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: none;
    overflow: visible;
  }
}

@media (max-width: 980px) {
  .shared-insight-column.panel {
    grid-column: 1;
    margin: 0 16px 16px;
  }
}


/* Stage 2.11.10: unified analysis input, viewport count, and expandable insights */
.visual-count-overlay {
  position: absolute;
  right: 14px;
  bottom: 10px;
  z-index: 3;
  padding: 4px 7px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .88);
  pointer-events: none;
}
.panel-heading-actions { display: flex; align-items: center; gap: 8px; }
.expand-button {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 1rem;
}
.expand-button:disabled { opacity: .38; cursor: default; }
.metrics-table { min-width: max-content; }
.metrics-table-wrap { overflow-x: auto; overscroll-behavior-inline: contain; }
.metrics-table .detail-category td { font-weight: 600; color: var(--muted); }
.analysis-tools-heading-row > h2 { margin: 0; font-size: 1rem; }
.analysis-expand-dialog-card {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
}
.expanded-analysis-content { min-height: 0; overflow: auto; padding-top: 8px; }
.expanded-analysis-content .metrics-table-wrap { margin: 0; }
.expanded-series-content svg { width: 100%; min-width: 760px; height: min(62vh, 560px); display: block; }
.expanded-series-content .analysis-series-view { display: block !important; }
@media (max-width: 700px) {
  .analysis-tools-heading-row { align-items: flex-start; }
  .analysis-heading-options { justify-content: flex-start; }
  .visual-count-overlay { right: 9px; bottom: 7px; }
}

/* Stage 2.11.11: fixed centre workspace, reliable insight scrolling, and refined expand controls */
.expand-button {
  align-items: start;
  padding-top: 5px;
}
.expand-icon {
  width: 19px;
  height: 19px;
  display: block;
  transform: translateY(-1px);
}
.expand-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shared-insight-column.panel {
  scrollbar-gutter: stable;
  overscroll-behavior-y: contain;
}
.shared-insight-column .metrics-table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
}
.shared-insight-column .forms-table-wrap {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

.visual-viewport.cloud-static {
  overflow: hidden;
}

@media (min-width: 1321px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }
  .app-shell {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }
  .workspace {
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    padding: 16px 18px;
    overflow: hidden;
  }
  .explore-layout,
  .unified-insights-layout,
  .activity-column {
    height: 100%;
    min-height: 0;
  }
  .activity-column {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 16px;
    padding-bottom: 0;
  }
  .activity-column > .cloud-card {
    height: auto;
    min-height: 0;
  }
  .activity-column > .integrated-search,
  .integrated-search {
    padding: 0;
  }
}


/* Stage 2.11.12: compact inline Search controls and centred insight expansion */
.analysis-tools-panel {
  min-height: 0;
  padding: 10px 14px 9px;
}
.analysis-tools-heading-row {
  margin-bottom: 6px;
}
.analysis-tool-form {
  gap: 0;
}
.analysis-query-inline {
  display: grid;
  grid-template-columns: minmax(220px, 1.45fr) minmax(190px, .75fr) auto;
  gap: 10px;
  align-items: end;
}
.analysis-query-inline > .field-group {
  min-width: 0;
  margin: 0;
}
.analysis-query-inline .comparison-query-field textarea,
.analysis-query-inline .comparison-query-field input[type="search"],
.analysis-query-inline .comparison-grouping-field select {
  height: 40px;
  min-height: 40px;
  max-height: 40px;
}
.analysis-query-inline .comparison-query-field textarea {
  resize: none;
  overflow-y: auto;
}
.analysis-query-inline .comparison-submit {
  min-height: 40px;
  align-self: end;
}
.analysis-tools-panel > .help {
  min-height: 16px;
  margin: 4px 0 0;
  line-height: 1.25;
}
.analysis-tools-panel > .help.status-empty {
  display: none;
}
.expand-button {
  align-items: center;
  padding-top: 0;
}
.expand-icon {
  transform: translateY(2px);
}
@media (max-width: 760px) {
  .analysis-query-inline {
    grid-template-columns: 1fr;
  }
  .analysis-query-inline .comparison-submit {
    justify-self: end;
  }
}


/* Stage 2.11.13: contextual insight title and quieter measures rows */
.insight-details-heading {
  margin-bottom: 14px;
}
.insight-details-heading h2 {
  min-width: 0;
  overflow-wrap: anywhere;
}
.measures-table-heading {
  margin-bottom: 6px;
}
.measures-table-heading h3 {
  margin: 0;
  font-size: 1rem;
}
.metrics-table tbody tr {
  background: transparent;
  border-radius: 0;
}
.metrics-table tbody tr.detail-stat {
  background: transparent;
}
.metrics-table thead tr {
  background: var(--surface-soft);
}


/* Stage 2.11.14: content-mode-driven result families and compact toolbar icons */
.toolbar-icon-button {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.toolbar-icon {
  width: 20px;
  height: 20px;
  display: block;
  overflow: visible;
}
.toolbar-icon path,
.toolbar-icon circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cloud-toolbar .export-actions {
  flex-wrap: nowrap;
}


/* Stage 2.11.16: unified insight title and paper-level series details */
.series-point,
.comparison-series-point {
  cursor: pointer;
}
.series-point:focus,
.comparison-series-point:focus {
  outline: none;
  stroke-width: 4;
}
.series-point-dialog-card {
  width: min(760px, calc(100vw - 32px));
}
.series-point-dialog-content {
  max-height: min(68vh, 680px);
  overflow: auto;
}
.series-point-summary {
  margin: 0 0 12px;
  color: var(--muted);
}
.series-point-table-wrap {
  max-height: min(56vh, 560px);
  overflow: auto;
}
.series-point-table td:last-child,
.series-point-table th:last-child {
  text-align: right;
}


/* Stage 2.11.16: unified included matches and detailed series hover */
.forms-table-wrap {
  overflow-x: hidden;
}
.forms-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.forms-table th:first-child,
.forms-table td:first-child {
  width: 38%;
  min-width: 0;
  overflow-wrap: anywhere;
}
.forms-table th:nth-child(2),
.forms-table td:nth-child(2) {
  width: 24%;
  white-space: normal;
}
.forms-table th:nth-child(3),
.forms-table td:nth-child(3) {
  width: 18%;
  text-align: right;
}
.forms-table .metric-table-action {
  width: 82px;
  text-align: right;
}
.forms-table tbody th,
.forms-table tbody td {
  border-bottom: 0;
  text-decoration: none;
}
.forms-table tbody tr + tr th,
.forms-table tbody tr + tr td {
  border-top: 0;
}
.included-match-row.is-excluded {
  color: var(--muted);
  background: var(--surface-soft);
}
.included-match-row.is-excluded th {
  text-decoration: line-through;
}
.included-match-toggle,
.selected-form-toggle,
.search-form-toggle {
  min-width: 72px;
  justify-content: center;
}
.included-match-count {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.series-hover-tooltip {
  position: fixed;
  z-index: 1200;
  max-width: min(360px, calc(100vw - 24px));
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(18, 34, 57, .96);
  color: #fff;
  box-shadow: 0 10px 28px rgba(16, 34, 60, .24);
  font-size: .78rem;
  line-height: 1.45;
  white-space: pre-line;
  pointer-events: none;
}
.series-hover-tooltip.hidden { display: none; }

/* Stage 2.11.16 table-width refinement */
.forms-table thead th {
  white-space: normal;
  line-height: 1.15;
  font-size: .72rem;
}
.forms-table th:first-child,
.forms-table td:first-child { width: 36%; }
.forms-table th:nth-child(2),
.forms-table td:nth-child(2) { width: 20%; }
.forms-table th:nth-child(3),
.forms-table td:nth-child(3) { width: 20%; }
.forms-table .metric-table-action { width: 24%; }
.included-match-toggle,
.selected-form-toggle,
.search-form-toggle {
  min-width: 64px;
  padding-inline: 7px;
}


/* Stage 2.11.19: search-first workspace and wider, scroll-safe insight heading */
.activity-column > .integrated-search,
.integrated-search {
  padding: 0;
}

.insight-details-heading {
  min-width: 0;
}

.insight-title-scroll {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.insight-title-scroll h2,
.insight-details-heading h2 {
  width: max-content;
  min-width: max-content;
  max-width: none;
  margin: 0;
  white-space: nowrap;
  overflow-wrap: normal;
}

@media (min-width: 1321px) {
  .activity-column {
    grid-template-rows: auto minmax(0, 1fr);
  }
}


/* Stage 2.11.20: balanced Search-card spacing and shared single-result presentation */
.analysis-tools-panel {
  padding: 12px 14px 14px;
}

.single-insight-shared {
  min-width: 0;
}


/* Stage 2.11.21: exact single-insight presentation */
.single-insight-content {
  min-width: 0;
}

/* Stage 2.11.22: identical single-insight widths */

.shared-statistics-panel .single-insight-shared,
.shared-statistics-panel .single-insight-content,
.shared-statistics-panel #itemDetails,
.shared-statistics-panel #searchDetails {
  width: 100%;
  min-width: 0;
}

.shared-statistics-panel #itemDetails,
.shared-statistics-panel #searchDetails {
  display: block;
  overflow: visible;
  padding-right: 0;
}

/* Stage 2.11.23: shared included matches and aligned series charts */

.shared-series-panel {
  padding-bottom: 18px !important;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line) !important;
}

.shared-matches-panel {
  min-height: 0;
  height: auto;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.included-matches-heading {
  margin-bottom: 8px;
}

.included-matches-heading h2 {
  margin: 0;
  font-size: 1rem;
}

.included-matches-content {
  min-width: 0;
}

.included-matches-content .metrics-table-wrap,
.included-matches-content .forms-table-wrap,
.included-matches-content .metrics-table {
  width: 100%;
  min-width: 0;
}

.included-match-row.is-separated > * {
  opacity: .66;
}

.included-match-row.is-separated .metric-table-action,
.included-match-row.is-separated .metric-table-action * {
  opacity: 1;
}

.comparison-match-group + .comparison-match-group {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.comparison-match-group > h3 {
  margin: 0 0 8px;
  font-size: .95rem;
}

.series-area {
  display: none !important;
}

.series-line,
.comparison-series-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.comparison-series-point {
  stroke-width: 2;
}

.series-point,
.comparison-series-point {
  transition: r .12s ease, filter .12s ease, stroke-width .12s ease;
}

.series-point:hover,
.series-point:focus,
.comparison-series-point:hover,
.comparison-series-point:focus {
  r: 5px;
  filter: drop-shadow(0 0 4px rgba(36, 87, 214, .42));
}

.series-hover-tooltip {
  max-width: none;
  white-space: nowrap;
}

.analysis-expand-dialog-card {
  width: min(1120px, calc(100vw - 36px));
}

.expanded-series-content .analysis-series-wrap,
.expanded-series-content #timeSeriesSvg,
.expanded-series-content #searchSeriesSvg,
.expanded-series-content #comparisonSeriesSvg {
  width: 100%;
  min-width: 900px;
  min-height: min(62vh, 560px);
  height: min(62vh, 560px);
}

@media (max-width: 1320px) {
  .shared-matches-panel {
    grid-column: 1 / -1;
  }
}

/* Stage 2.11.24: persistent timeline emphasis and clearer series details */

.series-label {
  font-size: 12px;
}

.series-label-vertical {
  font-size: 11px;
}

.expanded-series-content .series-label {
  font-size: 13px;
}

.expanded-series-content .series-label-vertical {
  font-size: 12px;
}

.comparison-series-colour {
  position: relative;
  width: 30px;
  height: 3px;
  border-radius: 999px;
  background: var(--series-colour);
  flex: 0 0 auto;
}

.comparison-series-colour::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border: 2px solid var(--series-colour);
  border-radius: 50%;
  background: var(--surface);
  transform: translate(-50%, -50%);
}

.comparison-series-point {
  fill: var(--surface) !important;
  stroke: var(--series-colour, var(--accent)) !important;
  stroke-width: 2px;
}

.series-point-matrix-table {
  table-layout: fixed;
}

.series-point-matrix-table th:first-child {
  width: 34%;
  text-align: left;
}

.series-point-matrix-table th:not(:first-child),
.series-point-matrix-table td {
  width: 33%;
  text-align: center;
}

.included-match-exclude-actions {
  justify-content: flex-end;
  margin: 10px 0 0;
}

/* Stage 2.11.26: clearer series geometry and colour-keyed comparison legend */

.shared-series-panel .analysis-series-wrap,
.shared-series-panel #timeSeriesSvg,
.shared-series-panel #searchSeriesSvg,
.shared-series-panel #comparisonSeriesSvg {
  min-height: 330px;
  height: 330px;
}

.series-label {
  font-size: 14px !important;
  font-weight: 600;
}

.series-label-vertical {
  font-size: 13px !important;
  font-weight: 600;
}

.series-line,
.comparison-series-line {
  stroke-width: 3px;
}

.series-point,
.comparison-series-point {
  stroke-width: 2.25px;
}

.series-point:hover,
.series-point:focus,
.comparison-series-point:hover,
.comparison-series-point:focus {
  r: 6.25px;
}

.comparison-series-term {
  color: var(--series-colour) !important;
}

.comparison-series-term b {
  color: inherit !important;
}

.comparison-series-colour {
  display: inline-block;
  width: 32px;
  height: 4px;
  border-radius: 999px;
  background: var(--series-colour) !important;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--series-colour) 22%, transparent);
}

.comparison-series-colour::after {
  width: 9px;
  height: 9px;
  border: 2.25px solid var(--series-colour);
}

.expanded-series-content .analysis-series-wrap,
.expanded-series-content #timeSeriesSvg,
.expanded-series-content #searchSeriesSvg,
.expanded-series-content #comparisonSeriesSvg {
  min-height: min(62vh, 560px);
  height: min(62vh, 560px);
}

.expanded-series-content .series-label {
  font-size: 16px !important;
}

.expanded-series-content .series-label-vertical {
  font-size: 15px !important;
}

/* Stage 2.11.26: larger series labels, explicit comparison keys, and compact point matrix */

.shared-statistics-panel,
.shared-insight-column > .shared-statistics-panel {
  border-bottom: 0 !important;
}

.series-label {
  font-size: 18px !important;
  font-weight: 600;
}

.series-label-vertical {
  font-size: 17px !important;
  font-weight: 600;
}

.expanded-series-content .series-label {
  font-size: 20px !important;
}

.expanded-series-content .series-label-vertical {
  font-size: 19px !important;
}

.series-line,
.comparison-series-line {
  stroke-width: 4px !important;
}

.series-point {
  fill: var(--accent) !important;
  stroke: var(--accent) !important;
  stroke-width: 2.5px !important;
}

.comparison-series-point {
  fill: var(--series-colour, var(--accent)) !important;
  stroke: var(--series-colour, var(--accent)) !important;
  stroke-width: 2.5px !important;
}

.series-point:hover,
.series-point:focus,
.comparison-series-point:hover,
.comparison-series-point:focus {
  r: 8px;
}

.comparison-series-term {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  color: var(--series-colour) !important;
}

.comparison-series-term b {
  color: var(--series-colour) !important;
}

.comparison-series-key {
  display: block;
  width: 40px;
  height: 14px;
  flex: 0 0 40px;
  overflow: visible;
}

.series-point-dialog-card {
  width: min(620px, calc(100vw - 32px));
}

.series-point-dialog-content,
.series-point-table-wrap {
  overflow-x: hidden;
}

.series-point-table-wrap {
  width: 100%;
  max-width: 100%;
}

.series-point-table,
.series-point-matrix-table {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  table-layout: fixed !important;
}

.series-point-matrix-table th:first-child,
.series-point-matrix-table td:first-child {
  width: 34% !important;
}

.series-point-matrix-table th:not(:first-child),
.series-point-matrix-table td:not(:first-child) {
  width: 33% !important;
  text-align: center !important;
  white-space: normal !important;
}

/* Stage 2.11.27: colour-tracked bars, compact sections, and legible chart modals */

.shared-insight-column > .shared-statistics-panel,
.shared-statistics-panel {
  padding-bottom: 8px !important;
  margin-bottom: 8px !important;
}

.shared-series-panel {
  padding-top: 6px !important;
  padding-bottom: 8px !important;
  margin-bottom: 8px !important;
  border-bottom: 0 !important;
}

.included-matches-heading {
  margin-bottom: 5px;
}

.comparison-match-group + .comparison-match-group {
  margin-top: 12px;
  padding-top: 0;
  border-top: 0;
}

.shared-series-panel .analysis-series-wrap,
.shared-series-panel #timeSeriesSvg,
.shared-series-panel #searchSeriesSvg,
.shared-series-panel #comparisonSeriesSvg {
  min-height: 360px;
  height: 360px;
}

.series-label {
  font-size: 20px !important;
  font-weight: 600;
}

.series-label-vertical {
  font-size: 19px !important;
  font-weight: 600;
}

.series-line,
.comparison-series-line {
  stroke-width: 5px !important;
}

.series-point,
.comparison-series-point {
  r: 7.5px;
  stroke-width: 0 !important;
}

.series-point {
  fill: var(--accent) !important;
  stroke: var(--accent) !important;
}

.comparison-series-point {
  fill: var(--series-colour) !important;
  stroke: var(--series-colour) !important;
}

.comparison-series-key {
  position: relative;
  display: inline-block !important;
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  height: 14px !important;
  min-height: 14px !important;
  flex: 0 0 40px !important;
  overflow: visible;
}

.comparison-series-key::before {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  top: 5px;
  height: 4px;
  border-radius: 999px;
  background: var(--series-colour);
}

.comparison-series-key::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--series-colour);
  transform: translate(-50%, -50%);
}

.expanded-series-content .comparison-series-legend {
  margin: 0 0 8px;
  gap: 6px 14px;
  font-size: .9rem;
}

.expanded-series-content .comparison-series-legend-set,
.expanded-series-content .comparison-series-term {
  gap: 7px;
}

.expanded-series-content .comparison-series-key {
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  height: 14px !important;
  min-height: 14px !important;
}

.expanded-series-content .analysis-series-wrap,
.expanded-series-content #timeSeriesSvg,
.expanded-series-content #searchSeriesSvg,
.expanded-series-content #comparisonSeriesSvg {
  min-height: min(68vh, 620px);
  height: min(68vh, 620px);
}

.expanded-series-content .series-label {
  font-size: 22px !important;
}

.expanded-series-content .series-label-vertical {
  font-size: 21px !important;
}

/* Stage 2.11.28: explicit comparison keys and per-line vertices */

.series-point,
.comparison-series-point {
  fill: var(--point-colour, var(--accent)) !important;
  stroke: var(--point-colour, var(--accent)) !important;
}

.comparison-series-key-svg {
  display: block;
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  height: 16px;
  min-height: 16px;
  flex: 0 0 42px;
  overflow: visible;
}

.expanded-series-content .comparison-series-key-svg {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  height: 16px;
  min-height: 16px;
}

/* Stage 2.11.29: clone-safe per-series point colours */

.comparison-series-point.comparison-series-colour-0 { fill: #2457d6 !important; stroke: #2457d6 !important; }
.comparison-series-point.comparison-series-colour-1 { fill: #c026d3 !important; stroke: #c026d3 !important; }
.comparison-series-point.comparison-series-colour-2 { fill: #059669 !important; stroke: #059669 !important; }
.comparison-series-point.comparison-series-colour-3 { fill: #dc2626 !important; stroke: #dc2626 !important; }
.comparison-series-point.comparison-series-colour-4 { fill: #7c3aed !important; stroke: #7c3aed !important; }
.comparison-series-point.comparison-series-colour-5 { fill: #0891b2 !important; stroke: #0891b2 !important; }
.comparison-series-point.comparison-series-colour-6 { fill: #d97706 !important; stroke: #d97706 !important; }

/* Stage 2.12.8: consolidated visual focus styles */
.cloud-word,
.cloud-word:hover,
.cloud-word:focus,
.cloud-word.analysis-query-highlight,
.cloud-word.analysis-item-selected {
  font-weight: 700 !important;
  transform: none !important;
  filter: none !important;
  stroke: none !important;
  paint-order: normal !important;
  text-rendering: geometricPrecision;
  text-shadow: none !important;
  transition: none !important;
}

.cloud-word:hover,
.cloud-word:focus,
.cloud-word.analysis-query-highlight,
.cloud-word.analysis-item-selected {
  fill: var(--analysis-original-fill, currentColor) !important;
  stroke-width: 0 !important;
}

.analysis-query-highlight-backdrop,
.analysis-query-highlight-marker {
  display: none !important;
}

.cloud-highlight-backdrop {
  opacity: .92;
}

.bar-highlight-backdrop {
  opacity: .72;
}

.cloud-highlight-layer {
  pointer-events: none;
}

.cloud-highlight-rect {
  pointer-events: none;
  shape-rendering: geometricPrecision;
  stroke-width: 1px;
  rx: .75px;
  transition: opacity 110ms ease;
}

.cloud-highlight-rect.is-strong {
  fill: rgba(255, 238, 88, .58);
  stroke: rgba(225, 179, 0, .88);
}

.cloud-highlight-rect.is-hover {
  fill: rgba(255, 244, 128, .34);
  stroke: rgba(225, 179, 0, .52);
}

.bar-row.analysis-query-highlight .bar-fill,
.bar-row.analysis-item-selected .bar-fill {
  fill: var(--analysis-selection-colour, #eab308) !important;
  stroke: none !important;
  stroke-width: 0 !important;
  filter: none !important;
  opacity: 1 !important;
  transform: none !important;
  transition: filter 120ms ease, opacity 120ms ease;
}

.bar-row:hover .bar-value,
.bar-row:focus .bar-value {
  fill: var(--ink);
  font-weight: 700 !important;
  filter: drop-shadow(0 0 3px rgba(255, 241, 70, .48));
  transform: none !important;
}

.bar-row.analysis-query-highlight .bar-label,
.bar-row.analysis-query-highlight .bar-value,
.bar-row.analysis-item-selected .bar-label,
.bar-row.analysis-item-selected .bar-value {
  fill: var(--analysis-selection-colour, #a16207) !important;
  font-weight: 800 !important;
  filter: none !important;
  transform: none !important;
}

.bar-row:hover .bar-fill,
.bar-row:focus .bar-fill {
  stroke: none !important;
  stroke-width: 0 !important;
  filter: none !important;
  opacity: .86;
  transform: none !important;
  transition: filter 120ms ease, opacity 120ms ease;
}

.bar-row:hover .bar-label,
.bar-row:focus .bar-label {
  fill: var(--ink);
  font-weight: 700 !important;
  filter: none !important;
  transform: none !important;
}

.visual-count-overlay.analysis-query-truncated {
  color: var(--ink);
  background: var(--surface);
  box-shadow:
    0 0 5px rgba(255, 241, 70, .92),
    0 0 15px rgba(255, 232, 36, .58);
  font-weight: 800;
}

/* Stage 2.11.33: single-series legends and cleaner comparison match groups */
.single-series-legend {
  justify-content: flex-start;
}
.single-series-legend .comparison-series-legend-set {
  width: auto;
}


/* Stage 2.11.34: slightly clearer separation between insight title and measures */
.insight-details-heading {
  margin-bottom: 18px !important;
}


/* Stage 2.11.35: genuinely empty statistics state and visual multi-selection */
.idle-insight-placeholder {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  padding: 28px 24px;
  color: var(--muted);
  text-align: center;
  line-height: 1.55;
}

.shared-insight-column.analysis-idle {
  grid-template-rows: minmax(0, 1fr);
}

.shared-insight-column.analysis-idle > .shared-statistics-panel {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
}

.shared-insight-column.analysis-idle .measures-table-heading,
.shared-insight-column.analysis-idle .insight-view,
.shared-insight-column.analysis-idle > .shared-series-panel,
.shared-insight-column.analysis-idle > .shared-matches-panel {
  display: none !important;
}

.shared-insight-column.analysis-idle .idle-insight-placeholder {
  display: grid !important;
}

@media (max-width: 1320px) {
  .shared-insight-column.analysis-idle {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(340px, 1fr);
  }
}
