:root {
  color-scheme: light;
  --bg: #fcfdfc;
  --panel: #ffffff;
  --panel-soft: #f1f4f2;
  --ink: #12211d;
  --muted: #5d6b66;
  --line: #e3e8e5;
  --accent: #0e5c4a;
  --accent-soft: #e9f4f0;
  --amber: #8a6a16;
  --amber-soft: #fdf4da;
  --blue: #5b3baf;
  --blue-soft: #f3eefe;
  --danger: #a33a3a;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(20, 30, 40, 0.08);
  --detail-width: 380px;
  --topic-card-min: 300px;
  --topic-compact-card-min: 210px;
  --font-sans: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-serif: "Newsreader", Georgia, serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
}

body.resizing-detail {
  cursor: col-resize;
  user-select: none;
}

body.auth-pending .app-shell {
  visibility: hidden;
}

body.auth-required .app-shell,
body.tos-required .app-shell {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

.beta-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.app-nav-terms {
  border: 0;
  background: transparent;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.auth-gate {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(246, 247, 248, 0.78);
  backdrop-filter: blur(8px);
}

.auth-gate.hidden {
  display: none;
}

.auth-card {
  width: min(420px, calc(100vw - 48px));
  display: grid;
  gap: 22px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(20, 30, 40, 0.16);
}

.auth-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.tos-card {
  width: min(560px, calc(100vw - 48px));
  max-height: min(680px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tos-card > * {
  flex: 0 0 auto;
}

.tos-card .beta-pill {
  margin-bottom: 10px;
}

.tos-body {
  flex: 1 1 auto;
  min-height: 80px;
  overflow-y: auto;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  font-size: 13px;
  color: var(--ink);
}

.tos-body p {
  margin: 0 0 10px;
}

.tos-body p:last-child {
  margin-bottom: 0;
}

.tos-agree-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--ink);
}

.tos-agree-row.hidden {
  display: none;
}

.tos-agree-row input {
  margin-top: 3px;
}

.tos-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.tos-actions .hidden {
  display: none;
}

.startup-error {
  max-width: 640px;
  margin: 80px auto;
  padding: 24px;
}

.startup-error p {
  margin-top: 12px;
  color: var(--danger);
}

.app-nav-tour {
  color: var(--accent);
  border-radius: 6px;
  animation: tour-nav-glow 2.8s ease-in-out infinite;
}

@keyframes tour-nav-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(15, 118, 110, 0); }
  50% { box-shadow: 0 0 0 5px rgba(15, 118, 110, 0.14); }
}

@media (prefers-reduced-motion: reduce) {
  .app-nav-tour {
    animation: none;
  }
}

.tour-overview-card {
  width: min(620px, calc(100vw - 48px));
}

.tour-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.tour-overview-item {
  position: relative;
  padding: 16px 14px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.tour-overview-item h3 {
  margin: 0 0 6px;
}

.tour-overview-item p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .tour-overview-grid {
    grid-template-columns: 1fr;
  }
}

.tour-overlay-root {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 900;
  pointer-events: none;
}

.tour-spotlight {
  position: fixed;
  border-radius: 10px;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 9999px rgba(15, 20, 24, 0.55);
  transition: top 0.2s ease, left 0.2s ease, width 0.2s ease, height 0.2s ease;
}

.tour-callout {
  position: fixed;
  z-index: 901;
  width: 320px;
  max-width: calc(100vw - 24px);
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(20, 30, 40, 0.28);
  pointer-events: auto;
}

.tour-callout-nav {
  border: 1px solid var(--accent);
  background: linear-gradient(165deg, var(--accent-soft) 0%, var(--panel) 60%);
  box-shadow: 0 18px 50px rgba(20, 30, 40, 0.28), 0 0 0 3px rgba(15, 118, 110, 0.12);
}

/* On small screens, dock the callout as a fixed bottom sheet instead of
   trying to place it beside whatever's spotlighted — there's often not
   enough room to do that without the two overlapping or crowding each
   other. This keeps it clear of the highlighted content regardless of
   where that content sits on the page. */
.tour-callout-sheet {
  top: 100vh;
  transform: translateY(-100%);
  left: 0;
  width: 100vw;
  max-width: 100vw;
  max-height: 65vh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -12px 40px rgba(20, 30, 40, 0.32);
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.tour-callout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tour-step-count {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
}

.tour-nav-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tour-skip {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  padding: 0;
}

.tour-skip:hover {
  color: var(--ink);
}

.tour-callout h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.tour-callout p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.tour-callout-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.tour-wait-hint {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.tour-wait-spinner::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--accent);
  animation: tour-pulse 1s ease-in-out infinite;
}

@keyframes tour-pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

button:hover {
  border-color: #b8c5ca;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  flex: 0 0 auto;
  width: 22px;
}

.brand-mark-bar {
  display: block;
  height: 4px;
  border-radius: 99px;
}

.brand-name {
  font-family: var(--font-sans);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.brand-name-s {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-nav-views {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--panel-soft);
}

.app-nav-views button {
  height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.app-nav-views button:hover {
  color: var(--ink);
}

.app-nav-views button.active {
  color: var(--accent);
  background: var(--panel);
  box-shadow: 0 1px 3px rgba(20, 30, 40, 0.14);
}

.app-nav-help {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  padding-left: 14px;
  /* Some of these ("Product Tour", "Terms") are <button> elements, which
     pick up the base `button` rule's full border + panel background. Reset
     that first so only the intended left divider (matching the <a>-based
     "Watch Demo") shows, not a boxed-button look. */
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
}

.app-nav-help:hover {
  color: var(--accent);
  text-decoration: underline;
}

.app-nav .auth-sign-out {
  height: 34px;
  padding: 0 14px;
  color: var(--muted);
  border: 0;
  background: transparent;
  white-space: nowrap;
}

.app-nav .auth-sign-out:hover {
  color: var(--ink);
}

.app-nav .auth-sign-out.hidden {
  display: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  font-weight: 700;
}

h2 {
  font-size: 18px;
  font-weight: 700;
}

.auth-card h2 {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 15px;
  font-weight: 700;
}

.result-count,
.meta-line,
.detail-meta,
.small-muted {
  color: var(--muted);
  font-size: 15px;
}

.result-count {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.topics-intro {
  color: var(--muted);
}

.info-tooltip {
  --tooltip-nudge: 0px;
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  cursor: help;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.info-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 600;
  width: max-content;
  max-width: 264px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #15191d;
  color: #f2f4f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 500;
  font-style: normal;
  text-transform: none;
  letter-spacing: 0.1px;
  line-height: 1.5;
  white-space: normal;
  text-align: left;
  box-shadow: 0 14px 28px rgba(10, 16, 20, 0.24), 0 3px 8px rgba(10, 16, 20, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px) scale(0.98) translateX(var(--tooltip-nudge));
  transition: opacity 140ms ease, transform 140ms ease;
}

.info-tooltip::before {
  content: "";
  position: absolute;
  z-index: 601;
  width: 8px;
  height: 8px;
  background: #15191d;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.info-tooltip[data-placement="left"]::after {
  top: calc(100% + 9px);
  right: -8px;
  transform-origin: top right;
}

.info-tooltip[data-placement="left"]::before {
  top: calc(100% + 5px);
  right: 4px;
  transform: rotate(45deg) translateX(var(--tooltip-nudge));
}

.info-tooltip[data-placement="right"]::after {
  top: 50%;
  left: calc(100% + 10px);
  transform: translateY(-50%) translateX(calc(-2px + var(--tooltip-nudge))) scale(0.98);
  transform-origin: left center;
}

.info-tooltip[data-placement="right"]::before {
  top: 50%;
  left: calc(100% + 5px);
  transform: translateY(-50%) translateX(var(--tooltip-nudge)) rotate(45deg);
}

.info-tooltip:hover,
.info-tooltip:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.info-tooltip:hover::after,
.info-tooltip:focus-visible::after,
.info-tooltip:hover::before,
.info-tooltip:focus-visible::before {
  opacity: 1;
}

.info-tooltip[data-placement="left"]:hover::after,
.info-tooltip[data-placement="left"]:focus-visible::after {
  transform: translateY(0) scale(1) translateX(var(--tooltip-nudge));
}

.info-tooltip[data-placement="right"]:hover::after,
.info-tooltip[data-placement="right"]:focus-visible::after {
  transform: translateY(-50%) translateX(var(--tooltip-nudge)) scale(1);
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8px clamp(280px, var(--detail-width), min(720px, 52vw));
  overflow: hidden;
}

body.stock-report-view .workspace {
  grid-template-columns: minmax(0, 1fr);
}

body.search-view .workspace {
  grid-template-columns: minmax(0, 1fr);
}

body.stock-report-view .detail-resizer,
body.stock-report-view .detail-panel,
body.stock-report-view #clearFilters {
  display: none;
}

body.search-view .detail-resizer,
body.search-view .detail-panel,
body.search-view #clearFilters {
  display: none;
}

.sidebar,
.detail-panel,
.content {
  min-height: 0;
  min-width: 0;
  max-width: 100%;
}

.sidebar {
  display: none;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 14px;
  overflow: auto;
}

.field {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

input:focus,
select:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

select:disabled {
  background: var(--panel-soft);
  color: var(--muted);
  cursor: not-allowed;
}

.ticker-autocomplete-field {
  position: relative;
}

.ticker-unsupported-hint {
  position: absolute;
  z-index: 30;
  top: calc(100% - 8px);
  left: 0;
  right: 0;
  padding: 8px 10px;
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.ticker-suggestions {
  position: absolute;
  z-index: 30;
  top: calc(100% - 8px);
  left: 0;
  right: 0;
  display: grid;
  gap: 2px;
  max-height: 220px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.ticker-suggestions button {
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  padding: 0 8px;
}

.ticker-suggestions button:hover {
  background: var(--accent-soft);
  color: #064e48;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 10px;
}

.control-grid .field:first-child {
  grid-column: 1 / -1;
}

.view-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 16px;
}

.view-tabs button,
.secondary-button,
.mini-button {
  height: 34px;
  border-radius: var(--radius);
  font-weight: 600;
}

.mini-button {
  height: 26px;
  padding: 0 8px;
  font-size: 12px;
}

.view-tabs button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #064e48;
}

.side-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.freeform-ask {
  margin: 4px 0 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.freeform-ask .ask-result {
  max-height: 520px;
  overflow: auto;
}

.ask-grid.compact {
  grid-template-columns: 1fr 1fr;
}

.section-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.facet-list {
  display: grid;
  gap: 6px;
}

.facet-button {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius);
  text-align: left;
}

.facet-button.active {
  background: var(--blue-soft);
  border-color: #9fbadb;
}

.facet-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.facet-count {
  min-width: 24px;
  border-radius: 999px;
  padding: 1px 7px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  padding: 16px 18px;
  overflow: hidden;
}

.content-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

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

.view-controls {
  margin-bottom: 14px;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafb;
}

.topic-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  column-gap: 14px;
  row-gap: 10px;
}

.topic-filter-bar .compact-field {
  flex: 1 1 130px;
  min-width: 0;
  margin-bottom: 0;
}

.topic-filter-bar .compact-field:first-child {
  flex-basis: 220px;
}

.topic-filter-bar .search-field {
  flex: 2 1 280px;
  min-width: min(100%, 220px);
  margin-left: 0;
}

.topic-filter-bar .topic-mini-filter {
  flex: 0 1 80px;
  min-width: 74px;
}

.topic-filter-bar .topic-mini-filter > span {
  white-space: nowrap;
}

.topic-filter-bar .topic-priority-field {
  flex: 0 0 auto;
  width: max-content;
  min-width: 68px;
  align-self: end;
}

.topic-priority-field > span {
  line-height: 17px;
}

.topic-priority-field .inline-check {
  height: 36px;
  width: max-content;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.inline-check input {
  width: 16px;
  height: 16px;
}

.search-workspace {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  height: 100%;
}

.search-filter-rail,
.search-question-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafb;
  box-shadow: var(--shadow);
}

.search-filter-rail {
  min-height: 0;
  padding: 12px;
  overflow: visible;
}

.search-filter-stack {
  display: grid;
  gap: 10px;
}

.search-filter-group {
  display: grid;
  gap: 10px;
}

.search-main-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.search-question-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 10px 12px;
}

.compact-field {
  margin-bottom: 0;
}

.search-field {
  min-width: 220px;
}

.search-question-field {
  margin-bottom: 0;
}

.search-question-field textarea {
  min-height: 50px;
  max-height: 86px;
  resize: vertical;
}

.search-actions {
  align-self: end;
  justify-content: flex-start;
  padding-bottom: 0;
}

.search-result-panel,
.stock-report-card {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 34px 74px -34px rgba(18, 33, 29, 0.18);
  padding: 16px;
}

body.search-view .content {
  padding: 12px 16px;
}

body.search-view .content-toolbar {
  margin-bottom: 6px;
}

body.search-view .view-controls {
  margin-bottom: 8px;
}

body.search-view .content-body {
  min-height: 0;
  overflow: hidden;
  padding-bottom: 0;
}

body.search-view .search-result-panel {
  height: 100%;
  min-height: 0;
  overflow: auto;
}

.stock-actions {
  align-self: end;
  padding-bottom: 1px;
}

.earnings-highlight {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
}

.earnings-highlight-actions {
  display: flex;
  justify-content: flex-end;
  padding: 4px 0 18px;
}

.earnings-glance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.earnings-glance-card {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 12px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-content: start;
  gap: 6px;
}

.earnings-glance-card.glance-positive {
  border-color: #9fd9c4;
}

.earnings-glance-card.glance-negative {
  border-color: #efb1b1;
}

.earnings-glance-card.glance-amber {
  border-color: #f1d38b;
}

.glance-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.glance-value {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
}

.glance-value[title] {
  cursor: help;
}

.glance-sources {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow: hidden;
  gap: 5px;
  padding-top: 8px;
  margin-top: 2px;
  border-top: 1px solid var(--line);
}

.glance-sources-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin-right: 1px;
  white-space: nowrap;
}

.glance-sources-more {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.glance-sources .unit-link {
  padding: 1px 4px;
  font-size: 10px;
}

.earnings-hero,
.earnings-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
}

.earnings-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.earnings-hero h3,
.earnings-panel h4 {
  margin: 0 0 8px;
}

.earnings-hero p,
.earnings-panel p {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
}

.earnings-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 220px;
}

.earnings-summary-grid,
.earnings-section-grid {
  display: grid;
  gap: 12px;
}

.earnings-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.earnings-section-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.earnings-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.earnings-panel ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.earnings-panel li {
  margin: 5px 0;
  line-height: 1.35;
}

.qa-panel,
.earnings-evidence {
  grid-column: 1 / -1;
}

.qa-signal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.qa-signal-group {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.muted {
  color: var(--muted) !important;
}

.toolbar-actions,
.taxonomy-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hidden {
  display: none !important;
}

.content-body {
  display: grid;
  gap: 12px;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  padding-bottom: 16px;
}

.content-body.keyword-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--topic-card-min)), 1fr));
  align-content: start;
  align-items: start;
}

.content-body.keyword-grid.keyword-entity-grid {
  --topic-card-min: var(--topic-compact-card-min);
  gap: 8px;
}

.group-card,
.topic-card,
.raw-card,
.seeded-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.group-card {
  overflow: hidden;
}

.group-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: #fbfcfc;
  border-bottom: 1px solid var(--line);
}

.group-title {
  display: grid;
  gap: 3px;
}

.group-body {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.topic-card,
.raw-card,
.seeded-card {
  padding: 12px;
}

.topic-card {
  display: grid;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.topic-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(20, 30, 40, 0.14);
  border-color: var(--accent);
}

.keyword-cluster-card {
  min-width: 0;
  min-height: 210px;
  overflow: hidden;
}

.keyword-cluster-card .topic-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.keyword-cluster-card .topic-title,
.keyword-cluster-card .chips {
  min-width: 0;
}

.keyword-cluster-card h3 {
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.keyword-cluster-card .meta-line,
.keyword-cluster-card .description {
  overflow-wrap: anywhere;
}

.keyword-cluster-card .score {
  max-width: 100px;
  white-space: normal;
  text-align: right;
}

.keyword-cluster-card .chip {
  max-width: 100%;
}

.keyword-cluster-card .keyword-section {
  display: grid;
  gap: 4px;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.keyword-cluster-card .keyword-section span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.keyword-entity-compact-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-height: 174px;
  height: auto;
  gap: 6px;
  padding: 10px 12px 10px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 1px 3px rgba(18, 33, 29, 0.07);
  overflow: hidden;
}

.entity-card-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 22px;
}

.keyword-entity-compact-card .entity-card-title {
  display: -webkit-box;
  margin: 8px 0 0;
  padding-right: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.22;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  overflow: hidden;
}

.entity-card-alert {
  display: -webkit-box;
  margin: 4px 0 0;
  color: #47554f;
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.entity-unit-count {
  white-space: nowrap;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
}

.entity-card-badges {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  min-width: 0;
}

.entity-card-tickers {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.entity-card-footer {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid #edf0ee;
  min-height: 36px;
}

.entity-card-badges:empty {
  display: none;
}

.keyword-entity-compact-card .chip,
.keyword-entity-compact-card .trend-count,
.keyword-entity-compact-card .priority-count,
.keyword-entity-compact-card .ticker-more {
  max-width: 100%;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
}

.keyword-entity-compact-card .chip.ticker {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  padding: 3px 8px;
}

.keyword-entity-compact-card .trend-count {
  min-height: 18px;
  padding: 2px 7px;
  font-size: 9px;
  font-weight: 600;
  text-transform: none;
}

.priority-count {
  min-height: 20px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 800;
}

.detail-resizer {
  width: 8px;
  cursor: col-resize;
  background: linear-gradient(to right, transparent, rgba(15, 118, 110, 0.12), transparent);
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
}

.detail-resizer:hover,
.detail-resizer.resizing {
  background: rgba(15, 118, 110, 0.18);
  border-color: rgba(15, 118, 110, 0.28);
}

.priority-high {
  background: #fbeded;
  color: #8a2a2a;
  border-color: #f2d2d2;
}

.priority-medium {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: #f0dfa8;
}

.priority-low {
  background: #e5e7eb;
  color: #4b5563;
}

.keyword-entity-compact-card .chip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticker-more {
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 700;
}

.keyword-entity-section {
  padding: 8px;
  border-radius: 6px;
  background: #f8faf9;
}

.keyword-trend-strip {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 4px 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.keyword-trend-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e3bd66;
}

.keyword-trend-title {
  display: grid;
  gap: 2px;
}

.keyword-trend-title strong {
  font-size: 15px;
}

.keyword-trend-count {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
}

.keyword-trend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--topic-card-min)), 1fr));
  gap: 8px;
  min-width: 0;
}

.keyword-entity-grid .keyword-trend-grid {
  --topic-card-min: var(--topic-compact-card-min);
}

.keyword-trend-group {
  display: grid;
  gap: 9px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.keyword-trend-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.keyword-trend-group-head div {
  display: grid;
  gap: 2px;
}

.keyword-trend-group-new {
  border-color: transparent;
  background: transparent;
}

.keyword-trend-group-spike {
  border-color: transparent;
  background: transparent;
}

.keyword-trend-group-spike-broadened {
  border-color: transparent;
  background: transparent;
}

.keyword-trend-group-broadened {
  border-color: transparent;
  background: transparent;
}

.keyword-trend-card {
  min-height: 0;
}

.keyword-grid-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding: 10px 2px 6px;
  border-top: 2px solid var(--line);
}

.keyword-grid-divider div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.keyword-hidden-clusters {
  grid-column: 1 / -1;
  margin-top: 8px;
  border-top: 1px solid var(--line);
}

.keyword-hidden-clusters summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.keyword-hidden-clusters summary strong {
  font-size: 12px;
  font-weight: 700;
}

.keyword-hidden-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--topic-compact-card-min)), 1fr));
  gap: 8px;
  min-width: 0;
  padding-bottom: 12px;
}

.keyword-hidden-card {
  opacity: 0.82;
}

.topic-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.raw-card.selected,
.seeded-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.cohort-pill.selected,
.cohort-topic-row.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  background: #edf8f5;
}

.cohort-pill.trend-highlight,
.cohort-topic-row.trend-highlight,
.topic-card.trend-highlight {
  border-color: #d49a2a;
  background: var(--panel);
}

.keyword-cluster-card.keyword-trend-new {
  border-color: var(--accent);
  background: var(--panel);
}

.keyword-cluster-card.keyword-trend-spike {
  border-color: var(--blue);
  background: var(--panel);
}

.keyword-cluster-card.keyword-trend-spike-broadened {
  border-color: var(--amber);
  background: var(--panel);
}

.keyword-cluster-card.keyword-trend-broadened {
  border-color: #059669;
  background: var(--panel);
}

.trend-count-new {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #cde6dd;
}

.trend-count-spike {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: #ddd0fa;
}

.trend-count-spike-broadened {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: #f0dfa8;
}

.trend-count-broadened {
  background: #d1fae5;
  color: #047857;
}

.cohort-badges .trend-count {
  min-width: 34px;
  background: var(--amber-soft);
  color: var(--amber);
}

.topic-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.topic-title {
  display: grid;
  gap: 2px;
}

.score {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--panel-soft);
  color: #3d4a50;
  font-size: 12px;
}

.chip.accent {
  background: var(--accent-soft);
  color: #07564f;
}

.chip-button {
  border: 0;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.chip-button:hover {
  box-shadow: 0 0 0 1px var(--accent);
}

.chip-button:active {
  transform: scale(0.96);
}

.chip-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.chip.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.chip.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.chip.red {
  background: #fee2e2;
  color: #991b1b;
}

.description {
  color: #344047;
}

.kv-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 12px;
}

.kv-grid dt {
  color: var(--muted);
  font-weight: 600;
}

.kv-grid dd {
  margin: 0;
}

.detail-panel {
  border-left: 1px solid var(--line);
  background: var(--panel);
  overflow: auto;
  padding: 16px;
}

.detail-empty {
  min-height: 140px;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.detail-panel h3 {
  margin-bottom: 4px;
}

.detail-panel .info-tooltip::after {
  max-width: 220px;
}

.detail-close-mobile {
  display: none;
}

html.mobile-detail-lock {
  overflow: hidden;
}

.mobile-notice {
  position: fixed;
  left: 12px;
  top: 12px;
  width: calc(100vw - 24px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #172026;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 10px 24px rgba(12, 20, 26, 0.3);
}

.mobile-notice button {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}

.detail-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.detail-section-title {
  position: relative;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-section-title .info-tooltip {
  position: static;
}

.detail-section-title .info-tooltip::after {
  left: 0;
  right: 12px;
  width: auto;
  max-width: none;
}

.detail-section-title .info-tooltip::before {
  display: none;
}

details.detail-section > summary.detail-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  cursor: pointer;
  list-style: none;
}

details.detail-section > summary.detail-section-title::-webkit-details-marker {
  display: none;
}

details.detail-section > summary.detail-section-title::before {
  content: "▸";
  color: var(--muted);
  font-size: 11px;
}

details.detail-section[open] > summary.detail-section-title {
  margin-bottom: 7px;
}

details.detail-section[open] > summary.detail-section-title::before {
  content: "▾";
}

.sample-text {
  max-height: 280px;
  overflow: auto;
  padding: 10px;
  border-radius: var(--radius);
  background: #f8faf9;
  color: #2b353a;
  font-size: 13px;
}

.unit-text {
  max-height: 460px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ask-panel {
  display: grid;
  gap: 10px;
}

.ask-question {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid #465652;
  border-radius: var(--radius);
  padding: 15px 17px;
  color: var(--ink);
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.5;
}

.ask-question:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.ask-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ask-actions {
  display: flex;
  gap: 8px;
}

.primary-button {
  height: 34px;
  border-radius: var(--radius);
  border-color: #2f3e3b;
  background: #2f3e3b;
  color: #fff;
  font-weight: 700;
}

.primary-button:hover {
  border-color: #22302d;
  background: #22302d;
}

.ask-result {
  display: grid;
  gap: 10px;
}

.answer-box,
.loading-box,
.error-box,
.evidence-window {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  padding: 10px;
}

.error-box {
  border-color: #e3b3b3;
  background: #fff4f4;
  color: var(--danger);
}

.loading-box {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  animation: loadingBoxIn 0.2s ease;
  align-self: start;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
}

.loading-box::before {
  content: "";
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loadingBoxIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.loading-box.llm-loading {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  min-width: 260px;
  max-width: 420px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--accent-soft), #f9fbfb 65%);
  border-color: var(--accent);
}

.loading-box.llm-loading::before {
  content: none;
}

.llm-loading-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.llm-loading-dots {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
}

.llm-loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: llmDotPulse 1s ease-in-out infinite;
}

.llm-loading-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.llm-loading-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes llmDotPulse {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: scale(0.75);
  }
  40% {
    opacity: 1;
    transform: scale(1.15);
  }
}

.llm-loading-stage {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  transition: opacity 0.2s ease;
}

.llm-loading-stage.stage-fade {
  opacity: 0;
}

.llm-loading-progress {
  position: relative;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.llm-loading-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 35%;
  border-radius: 999px;
  background: var(--accent);
  animation: llmProgressSweep 1.3s ease-in-out infinite;
}

@keyframes llmProgressSweep {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(285%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-box::before,
  .llm-loading-dots span,
  .llm-loading-progress::after {
    animation: none;
  }
}

.answer-box h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.answer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.answer-head h4 {
  margin: 0;
}

.answer-box ul {
  margin: 8px 0;
  padding-left: 18px;
}

.markdown-answer {
  display: grid;
  gap: 8px;
}

.markdown-answer h4,
.markdown-answer h5,
.markdown-answer h6 {
  margin: 4px 0 0;
  font-weight: 700;
}

.markdown-answer h4 {
  font-size: 16px;
}

.markdown-answer h5,
.markdown-answer h6 {
  font-size: 14px;
}

.markdown-answer p {
  margin: 0;
}

.markdown-answer ul {
  margin: 0;
  padding-left: 20px;
}

.markdown-answer li + li {
  margin-top: 4px;
}

.markdown-answer li > ul {
  margin-top: 5px;
  padding-left: 22px;
}

.markdown-answer li > ul li {
  font-size: 0.96em;
}

.markdown-answer code {
  border-radius: 5px;
  padding: 1px 5px;
  background: var(--panel-soft);
  color: #344047;
  font-family: var(--font-mono);
  font-size: 12px;
}

.unit-link {
  display: inline;
  border: 0;
  border-radius: 4px;
  padding: 2px 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78em;
  font-weight: 700;
  cursor: pointer;
}

.unit-link:hover {
  text-decoration: underline;
}

.caveat-box {
  margin-top: 8px;
  padding: 15px 17px;
  border: 1px solid #f0dfa8;
  border-radius: var(--radius);
  background: #fefbf2;
  color: #47554f;
  font-size: 13px;
  line-height: 1.5;
}

.evidence-window {
  max-height: 280px;
  overflow: auto;
}

.evidence-window p {
  margin: 8px 0 0;
}

.citation-row {
  padding: 5px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.smart-search-evidence {
  display: grid;
  gap: 10px;
}

.smart-search-plan summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
}

.smart-search-plan[open] {
  display: grid;
  gap: 10px;
}

.search-evidence-group {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.search-evidence-group summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}

.search-evidence-group .citation-row p {
  margin: 4px 0 0;
  color: #2f3a40;
}

.detail-row-button {
  width: 100%;
  display: block;
  text-align: left;
  color: inherit;
  background: transparent;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  cursor: pointer;
}

.detail-row-button:hover {
  background: var(--panel-soft);
}

.unit-topic-sentences {
  margin-top: 6px;
}

.sentence-list {
  display: grid;
  gap: 4px;
  margin: 6px 0 0;
  padding-left: 18px;
  color: #344047;
}

.sentence-list li {
  white-space: normal;
  overflow-wrap: anywhere;
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  /* Above the mobile detail-panel overlay (z-index up to 310, see the
     max-width: 1100px block below) so modals opened from within it — e.g.
     Analyze Topic Over Time, or the keyword unit modal — aren't hidden
     behind it on narrow viewports. */
  z-index: 400;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(15 23 42 / 42%);
}

.modal-card {
  width: min(980px, 96vw);
  max-height: min(820px, 92vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.5);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.modal-head h3 {
  margin: 0 0 4px;
}

.modal-close {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 10px;
  background: var(--panel-soft);
  color: var(--ink);
  cursor: pointer;
}

.modal-close:hover {
  border-color: var(--accent);
}

.modal-body {
  padding: 0 16px 16px;
}

.topic-evolution-modal {
  width: min(1320px, 96vw);
}

.topic-evolution-panel {
  display: grid;
  gap: 8px;
}

.topic-evolution-button {
  width: fit-content;
  max-width: 100%;
  display: grid;
  gap: 3px;
  justify-items: start;
  border: 1px solid #2f8f7b;
  border-radius: 8px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #effcf8 0%, #e2f7f1 100%);
  color: #075f4f;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px rgb(15 23 42 / 8%);
}

.topic-evolution-button:hover {
  border-color: #08705f;
  background: #daf5ed;
  box-shadow: 0 4px 14px rgb(15 23 42 / 10%);
}

.topic-evolution-button span {
  font-size: 15px;
  font-weight: 800;
}

.topic-evolution-button small {
  color: #44746b;
  font-size: 12px;
  font-weight: 600;
}

.topic-evolution-summary {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.topic-evolution-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topic-evolution-summary p {
  margin: 6px 0;
}

.topic-evolution-timeline {
  display: grid;
  grid-template-columns: repeat(var(--quarter-count, 4), minmax(220px, 1fr));
  gap: 12px;
  align-items: stretch;
  overflow-x: auto;
  padding-bottom: 8px;
}

.topic-evolution-quarter {
  min-width: 220px;
  display: grid;
  grid-auto-rows: auto;
  align-content: start;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.quarter-pill,
.tone-pill {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 9px;
  font-weight: 800;
  font-size: 12px;
}

.quarter-pill {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tone-pill {
  background: #eef2f7;
  color: var(--muted);
  text-transform: capitalize;
}

.tone-positive,
.tone-certain {
  background: #d8f7ea;
  color: #075f4f;
}

.tone-negative,
.tone-uncertain {
  background: #fee2e2;
  color: #991b1b;
}

.tone-mixed {
  background: #fef3c7;
  color: #92400e;
}

.quarter-summary {
  margin: 0;
  color: var(--muted);
}

.topic-evolution-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topic-evolution-quarter ul {
  margin: 0;
  padding-left: 18px;
}

.topic-evolution-quarter li {
  margin: 0 0 8px;
}

.topic-evolution-entities {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.topic-evolution-entities summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.topic-evolution-entity-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.topic-evolution-entity-chip {
  display: inline-grid;
  gap: 1px;
  max-width: 100%;
  border-radius: 999px;
  padding: 5px 9px;
  background: #eef5fb;
  color: #1f5b94;
  line-height: 1.2;
}

.topic-evolution-entity-chip strong {
  font-size: 12px;
}

.topic-evolution-entity-chip small {
  color: #64748b;
  font-size: 10px;
}

.matched-signal-chip {
  background: #e8f8ef;
  color: #075f4f;
}

.matched-signal-chip small {
  color: #3d7368;
}

.timeline {
  display: grid;
  gap: 6px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 72px 1fr 56px;
  gap: 8px;
  align-items: center;
}

.bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--panel-soft);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
}

.cohort-summary {
  display: grid;
  gap: 12px;
}

.cohort-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px;
}

.cohort-block h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.cohort-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.cohort-pill,
.cohort-topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  width: 100%;
}

.cohort-pill:hover,
.cohort-topic-row:hover {
  border-color: var(--accent);
  background: #f4fbf9;
}

.cohort-pill span,
.cohort-topic-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.cohort-pill strong {
  color: var(--accent-strong);
}

.cohort-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.cohort-badges strong {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  line-height: 1;
}

.cohort-badges .company-count {
  min-width: 24px;
  background: var(--blue-soft);
  color: var(--blue);
}

.cohort-list {
  display: grid;
  gap: 8px;
}

.compact-card {
  margin-top: 8px;
}

.muted-controls label {
  opacity: 0.55;
}

.industry-tickers-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 10px 16px;
  background-color: var(--panel-soft);
  border-bottom: 1px solid var(--line);
}

.industry-tickers-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.industry-tickers-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 1px 7px;
}

.industry-tickers-bar .chips {
  flex: 1 1 auto;
}

.industry-tickers-bar .chip {
  font-weight: 500;
}

.search-industry-tickers-bar {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
  width: 100%;
  min-width: 0;
}

.search-industry-tickers-bar .industry-tickers-label {
  white-space: normal;
}

.search-industry-tickers-bar .industry-tickers-count {
  margin-left: 6px;
}

.search-industry-tickers-bar .chips {
  width: 100%;
  min-width: 0;
  flex: none;
}

.stock-fetch-button {
  white-space: nowrap;
}

@media (max-width: 1100px) {
  body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    min-height: 100vh;
    height: auto;
    overflow: visible;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
  }

  .detail-resizer {
    display: none;
  }

  .detail-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 300;
    grid-column: unset;
    border-left: 0;
    border-top: 0;
    padding-top: 56px;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    visibility: hidden;
  }

  .detail-panel.mobile-open {
    transform: translateX(0);
    visibility: visible;
  }

  .detail-close-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 310;
    width: 32px;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--panel-soft);
    color: var(--ink);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
  }

  .content {
    overflow: visible;
    scroll-margin-top: 12px;
  }

  .content-body {
    overflow: visible;
  }

  .search-workspace {
    display: block;
    height: auto;
  }

  .search-filter-rail {
    overflow: visible;
    margin-bottom: 12px;
  }

  .search-filter-stack {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  /* Below this width, .search-filter-group (Ticker/Industry/Period,
     wrapped together only so the guided tour can spotlight them as one
     box on desktop) would otherwise count as a single item in the grid
     above, putting Search Type and the whole group side by side instead
     of letting all the fields flow together. Un-wrap it for layout
     purposes only — its children rejoin .search-filter-stack's own grid
     directly, exactly as if the wrapper weren't there. */
  .search-filter-group {
    display: contents;
  }
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-nav {
    flex-wrap: wrap;
    width: 100%;
    row-gap: 10px;
  }

  .app-nav-help {
    padding-left: 0;
    border-left: 0;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .detail-resizer {
    display: none;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content-toolbar,
  .group-header,
  .topic-head {
    align-items: stretch;
    flex-direction: column;
  }

  .content-body.keyword-grid {
    grid-template-columns: 1fr;
  }

  .content-body.keyword-grid.keyword-entity-grid,
  .keyword-entity-grid .keyword-trend-grid {
    grid-template-columns: 1fr;
  }

  .search-question-panel {
    grid-template-columns: 1fr;
  }
}
