:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #eef3f2;
  --text: #202124;
  --muted: #5f6368;
  --line: #d8dde3;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #d9f0ed;
  --amber: #b45309;
  --rose: #9d174d;
  --focus: #2563eb;
  --shadow: 0 12px 30px rgba(32, 33, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

a {
  color: var(--accent-strong);
}

a:hover {
  color: var(--rose);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.app-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(360px, 680px);
  gap: 20px;
  align-items: end;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 6px;
  font-size: 2rem;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.coverage {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.search {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
}

.search input {
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  color: var(--text);
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.search button,
.action-link,
.topic-button,
.chip-button {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
}

.search button {
  padding: 0 16px;
  color: white;
  background: var(--accent);
  font-weight: 700;
}

.search button:hover {
  background: var(--accent-strong);
}

.search .secondary {
  color: var(--text);
  background: var(--surface-muted);
  border-color: var(--line);
}

.layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-top: 20px;
}

.topic-panel,
.content-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topic-panel {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: hidden;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.panel-heading span {
  color: var(--muted);
  font-size: 0.86rem;
}

.topic-list {
  max-height: calc(100vh - 100px);
  overflow: auto;
  padding: 8px;
}

.topic-button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  width: 100%;
  margin: 0 0 6px;
  padding: 10px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.topic-button:hover,
.topic-button.active {
  background: var(--surface-muted);
}

.topic-button.active {
  border-color: var(--accent);
}

.topic-title {
  min-width: 0;
  font-weight: 700;
}

.topic-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.topic-score {
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.density {
  grid-column: 1 / -1;
  height: 5px;
  overflow: hidden;
  background: #e4e7eb;
  border-radius: 999px;
}

.density span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--amber));
}

.content-panel {
  min-height: 640px;
  padding: 22px;
}

.topic-detail h2,
.search-results h2 {
  font-size: 1.55rem;
  line-height: 1.2;
  margin-bottom: 12px;
}

.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.metric {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 32px;
  padding: 5px 9px;
  color: var(--muted);
  background: #f0f2f5;
  border-radius: 6px;
  font-size: 0.88rem;
}

.metric strong {
  color: var(--text);
}

.summary {
  max-width: 900px;
  margin-bottom: 18px;
  color: #2d3135;
}

.section-block {
  margin-top: 22px;
}

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

.chip,
.chip-button {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 9px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 700;
}

.chip-button {
  border-color: #b7d9d5;
}

.chip-button:hover {
  background: #c7e7e2;
}

.mention-list,
.result-list,
.video-list {
  display: grid;
  gap: 10px;
}

.mention,
.result,
.video-item {
  padding: 14px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mention-head,
.result-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.mention-title,
.result-title {
  font-weight: 800;
}

.date {
  color: var(--muted);
  font-size: 0.86rem;
}

.excerpt {
  margin: 0 0 12px;
  color: #34383d;
}

.action-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  color: white;
  background: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 800;
}

.action-link:hover {
  color: white;
  background: var(--accent-strong);
}

.search-results {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.search-note,
.empty-state {
  color: var(--muted);
}

.hidden {
  display: none;
}

.loading-row {
  height: 52px;
  margin: 8px;
  background: linear-gradient(90deg, #eef1f4, #f8f9fa, #eef1f4);
  background-size: 220% 100%;
  border-radius: 8px;
  animation: loading 1.2s ease-in-out infinite;
}

.loading-row.short {
  width: 72%;
}

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

@keyframes loading {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

@media (max-width: 980px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .layout {
    grid-template-columns: 1fr;
  }

  .topic-panel {
    position: static;
    max-height: none;
  }

  .topic-list {
    max-height: 360px;
  }
}

@media (max-width: 620px) {
  .topbar {
    padding: 16px;
  }

  h1 {
    font-size: 1.6rem;
  }

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

  .search button {
    width: 100%;
  }

  .content-panel {
    padding: 16px;
  }

  .topic-detail h2,
  .search-results h2 {
    font-size: 1.25rem;
  }
}
