:root {
  --background: #f4f6f8;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --text: #17212b;
  --muted: #667085;
  --border: #d9e0e7;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --danger-bg: #fff1f2;
  --danger-text: #9f1239;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  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(--background);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-weight: 800;
  letter-spacing: -0.04em;
}

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

.brand h1 {
  margin-bottom: 2px;
  font-size: 1.4rem;
}

.brand p {
  margin-bottom: 0;
  color: var(--muted);
}

.page {
  width: min(1240px, calc(100% - 32px));
  margin: 30px auto 48px;
}

.search-panel,
.results-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.search-panel {
  padding: 28px;
}

.search-panel h2,
.results-section h2 {
  margin-bottom: 16px;
  font-size: 1.25rem;
}

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

input[type="search"],
select {
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: white;
  color: var(--text);
}

input[type="search"] {
  width: 100%;
  padding: 0 16px;
  font-size: 1.05rem;
}

input[type="search"]:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.2);
  outline-offset: 1px;
  border-color: var(--accent);
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border-radius: 11px;
  padding: 0 22px;
  font-weight: 700;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
}

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

.secondary-button {
  align-self: end;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
}

.filters {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 260px)) auto;
  gap: 12px;
  align-items: end;
}

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

.field label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

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

.hint {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.results-section {
  margin-top: 22px;
  overflow: hidden;
}

.results-header {
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--border);
}

.results-header h2 {
  margin-bottom: 3px;
}

#result-summary {
  margin: 0;
  color: var(--muted);
}

.loading {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  white-space: nowrap;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.message {
  margin: 22px 24px;
  padding: 14px 16px;
  border-radius: 11px;
  background: var(--surface-alt);
  color: var(--muted);
}

.message.error {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1050px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: var(--surface-alt);
  color: #475467;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f9fbfb;
}

td {
  font-size: 0.92rem;
}

td.description {
  min-width: 330px;
}

.numeric {
  text-align: right;
  white-space: nowrap;
}

.company-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #e6fffb;
  color: #115e59;
  font-weight: 750;
  font-size: 0.78rem;
}

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: nowrap;
}

.cards {
  display: none;
  padding: 14px;
  gap: 12px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px;
  background: white;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.card h3 {
  margin: 12px 0 6px;
  font-size: 1rem;
}

.card-description {
  margin-bottom: 14px;
  line-height: 1.45;
}

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

.card-field span {
  display: block;
}

.card-label {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.card-value {
  margin-top: 2px;
  font-size: 0.9rem;
}

footer {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto 26px;
  color: var(--muted);
  text-align: center;
  font-size: 0.85rem;
}

.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;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .brand,
  .page,
  footer {
    width: min(100% - 20px, 1240px);
  }

  .brand {
    padding: 16px 0;
  }

  .brand p {
    display: none;
  }

  .page {
    margin-top: 16px;
  }

  .search-panel {
    padding: 18px;
  }

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

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

  .results-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-wrap {
    display: none !important;
  }

  .cards:not([hidden]) {
    display: grid;
  }
}
