:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #eef3f6;
  --line: #d8e0e6;
  --line-strong: #b7c4ce;
  --text: #17212b;
  --muted: #5d6a76;
  --teal: #0f766e;
  --teal-soft: #d9f0ed;
  --blue: #255f99;
  --blue-soft: #e3eef8;
  --amber: #946200;
  --amber-soft: #fff2c7;
  --red: #b42318;
  --red-soft: #fde7e4;
  --shadow: 0 12px 30px rgba(33, 46, 61, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

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

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: #0f1720;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

.sheet-link,
button {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.sheet-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  white-space: nowrap;
}

button {
  padding: 0 16px;
}

.sheet-link:hover,
button:hover,
.chip:hover {
  border-color: var(--teal);
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.12);
}

button:active,
.sheet-link:active,
.chip:active {
  transform: translateY(1px);
}

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

.search-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.8fr) minmax(170px, 1fr) minmax(170px, 1fr) minmax(150px, 0.8fr) auto;
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input {
  padding: 0 13px;
}

select {
  padding: 0 34px 0 12px;
}

input:focus,
select:focus,
button:focus-visible,
.sheet-link:focus-visible,
.chip:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18);
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.chip {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: #21303d;
  cursor: pointer;
  padding: 0 12px;
  white-space: nowrap;
}

.chip.is-active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: #064e49;
  font-weight: 700;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.metrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px 16px;
}

.metrics strong {
  display: block;
  font-size: 24px;
  line-height: 1.1;
}

.metrics span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.result-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 12px;
}

.result-bar p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.source-status {
  text-align: right;
}

.results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.provider-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 18px rgba(33, 46, 61, 0.05);
  padding: 16px;
}

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

.provider-title {
  min-width: 0;
}

.provider-title h2 {
  margin: 0;
  color: #0f1720;
  font-size: 19px;
  line-height: 1.22;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.provider-title p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.mention-badge {
  flex: 0 0 auto;
  min-width: 66px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  padding: 7px 8px;
}

.tag-row,
.contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: #eef2f7;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  padding: 0 10px;
}

.tag.category {
  background: var(--teal-soft);
  color: #064e49;
}

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

.tag.missing {
  background: var(--red-soft);
  color: var(--red);
}

.contact-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #123047;
  font-size: 13px;
  font-weight: 700;
  padding: 0 10px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.contact-link:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.notes {
  margin: 0;
  color: #243241;
  overflow-wrap: anywhere;
}

.meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.meta div {
  min-width: 0;
}

.meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.meta dd {
  margin: 3px 0 0;
  color: #243241;
  overflow-wrap: anywhere;
}

.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 32px;
  text-align: center;
}

.empty-state h2 {
  margin: 0;
  font-size: 22px;
}

.empty-state p {
  margin: 8px 0 0;
  color: var(--muted);
}

@media (max-width: 920px) {
  .search-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-field {
    grid-column: 1 / -1;
  }

  #clearButton {
    width: 100%;
  }

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

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

  .topbar {
    display: grid;
  }

  h1 {
    font-size: 28px;
  }

  .search-row,
  .metrics,
  .meta {
    grid-template-columns: 1fr;
  }

  .result-bar,
  .card-head {
    display: grid;
  }

  .source-status {
    text-align: left;
  }

  .mention-badge {
    width: max-content;
  }
}
