:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --ink: #16202a;
  --muted: #657283;
  --line: #d9e0e8;
  --panel: #ffffff;
  --blue: #255fda;
  --green: #18735d;
  --amber: #a96300;
  --rose: #b4233c;
  --shadow: 0 14px 40px rgba(30, 42, 58, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: 0;
}

.health {
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.health.ready {
  color: var(--green);
}

.health.degraded {
  color: var(--amber);
}

.health.unavailable {
  color: var(--rose);
}

.search-band {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
}

.search-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  outline: none;
}

.search-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 95, 218, 0.14);
}

.search-form button,
.tabs button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.search-form button {
  min-height: 46px;
  background: var(--blue);
  color: #fff;
}

.controls {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

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

.tabs button {
  min-height: 34px;
  padding: 0 12px;
  background: #eef2f7;
  color: #445161;
}

.tabs button.active {
  background: #dce8ff;
  color: var(--blue);
}

select {
  min-width: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.filters {
  display: flex;
  gap: 8px;
}

#category {
  min-width: min(260px, 55vw);
}

#signal {
  min-width: 156px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.home-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.home-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.topics-panel {
  grid-row: span 2;
}

.stat {
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.results-shell {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head h2 {
  font-size: 18px;
}

.section-head.compact {
  margin-bottom: 10px;
}

.section-head.compact h2 {
  font-size: 15px;
}

.section-head span {
  color: var(--muted);
  font-size: 13px;
}

.results {
  display: grid;
  gap: 10px;
}

.topic-list,
.mini-list,
.detail-list {
  display: grid;
  gap: 8px;
}

.topic-card,
.mini-row {
  display: block;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  background: #fff;
}

.topic-card:hover,
.mini-row:hover {
  border-color: rgba(37, 95, 218, 0.45);
}

.topic-card strong,
.mini-row strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.25;
}

.topic-card p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.case-row p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.topic-card span,
.mini-row span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.result h3 {
  margin: 0 0 7px;
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: 0;
}

.result p {
  color: var(--muted);
  line-height: 1.45;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.actions a,
.action-link,
.plain-button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
}

.plain-button {
  justify-content: center;
  width: fit-content;
}

.tag {
  padding: 4px 7px;
  border-radius: 6px;
  background: #eef2f7;
  color: #445161;
  font-size: 12px;
  font-weight: 700;
}

.tag.signal {
  background: #e9f7f2;
  color: var(--green);
}

.metric {
  min-width: 92px;
  color: var(--muted);
  text-align: right;
  font-size: 13px;
}

.empty {
  padding: 30px 14px;
  color: var(--muted);
  text-align: center;
}

.empty.tight {
  padding: 12px;
}

.topic-detail {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.topic-detail p {
  color: var(--muted);
  line-height: 1.45;
}

.entity-hero {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.entity-hero h2 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.15;
}

.entity-hero .subtitle {
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 700;
}

.entity-hero p,
.detail-section p {
  color: var(--muted);
  line-height: 1.45;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.metric-strip div {
  min-height: 58px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.metric-strip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.metric-strip strong {
  display: block;
  margin-top: 6px;
  font-size: 17px;
}

.detail-section {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.fact {
  display: grid;
  gap: 5px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.fact:first-of-type {
  border-top: 0;
}

.fact strong {
  color: var(--ink);
  font-size: 13px;
  text-transform: capitalize;
}

.readme-body {
  max-width: 100%;
  overflow: hidden;
}

.readme-body h3,
.readme-body h4,
.readme-body h5 {
  margin: 14px 0 8px;
}

.readme-body p,
.readme-body li {
  color: var(--ink);
  line-height: 1.55;
}

.readme-body pre {
  overflow-x: auto;
  padding: 12px;
  border-radius: 8px;
  background: #101827;
  color: #eef4ff;
}

.readme-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.readme-body img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.back-link {
  color: var(--blue);
  text-decoration: none;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 12px;
  }

  .topbar,
  .controls,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .filters {
    flex-direction: column;
  }

  #category {
    min-height: 38px;
    width: 100%;
  }

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

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-grid,
  .metric-strip {
    grid-template-columns: 1fr;
  }

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

  .metric {
    text-align: left;
  }
}
