:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #686868;
  --line: #d8ddd8;
  --paper: #fbfbf7;
  --surface: #ffffff;
  --soft: #eef4ef;
  --accent: #0f8f72;
  --accent-2: #d94f45;
  --wash: #f2f7f5;
  --radius: 8px;
  --shadow: 0 14px 36px rgba(23, 23, 23, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--accent);
  border-color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
}

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

.topbar {
  min-height: 92px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 580px);
  align-items: center;
  gap: 24px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 251, 247, 0.94);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(14px);
}

.topbar h1,
.section-title h2,
.pane-head h2,
.empty-detail h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 30px;
  line-height: 1.05;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

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

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(360px, 500px) minmax(480px, 1fr);
  gap: 0;
  min-height: calc(100vh - 92px);
}

.rail,
.results-pane,
.detail-pane {
  min-width: 0;
}

.rail {
  border-right: 1px solid var(--line);
  background: var(--wash);
}

.rail-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  filter: saturate(0.9) contrast(1.02);
}

.stats,
.filters {
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

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

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

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

.coverage {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.coverage-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.coverage-row strong {
  color: var(--ink);
}

.filters {
  display: grid;
  gap: 14px;
}

.filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.results-pane {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-height: calc(100vh - 92px);
}

.pane-head {
  padding: 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.pane-head p {
  margin-bottom: 0;
}

.results-list {
  overflow: auto;
}

.result-item {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: white;
  color: var(--ink);
  padding: 18px 22px;
  min-height: 124px;
}

.result-item:hover,
.result-item.active {
  background: var(--soft);
  color: var(--ink);
  border-color: var(--line);
}

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

.result-title strong {
  overflow-wrap: anywhere;
}

.status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  color: white;
  background: var(--accent);
}

.status.closed {
  background: var(--accent-2);
}

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

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.pager {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.pager span {
  text-align: center;
  color: var(--muted);
}

.detail-pane {
  overflow: auto;
  max-height: calc(100vh - 92px);
}

.empty-detail {
  padding: 48px;
  max-width: 640px;
}

.company-detail {
  padding: 28px;
  display: grid;
  gap: 26px;
  animation: detail-in 220ms ease both;
}

@keyframes detail-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hidden {
  display: none;
}

.identity {
  display: grid;
  gap: 18px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.identity h2 {
  margin: 0;
  font-size: 42px;
  line-height: 1.02;
  max-width: 900px;
  overflow-wrap: anywhere;
}

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

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.secondary-button {
  background: transparent;
  color: var(--ink);
}

.secondary-button:hover {
  background: var(--soft);
  border-color: var(--accent);
}

.detail-section {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 26px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.detail-section h3 {
  margin: 0;
  font-size: 18px;
}

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

.fact {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  min-width: 0;
}

.fact span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.fact strong {
  display: block;
  overflow-wrap: anywhere;
}

.establishment-list,
.timeline-list {
  display: grid;
  gap: 10px;
}

.establishment,
.empty-state,
.timeline-item,
.map-surface {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: white;
}

.map-surface {
  min-height: 170px;
  display: grid;
  align-content: space-between;
  background:
    linear-gradient(90deg, rgba(15, 143, 114, 0.12) 1px, transparent 1px),
    linear-gradient(0deg, rgba(15, 143, 114, 0.12) 1px, transparent 1px),
    #f8fbf9;
  background-size: 28px 28px;
}

.establishment-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.empty-state {
  color: var(--muted);
  background: var(--wash);
}

.source-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

@media (max-width: 1160px) {
  .workspace {
    grid-template-columns: 280px 1fr;
  }

  .detail-pane {
    grid-column: 1 / -1;
    max-height: none;
    border-top: 1px solid var(--line);
  }

  .results-pane {
    max-height: 620px;
  }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr;
    padding: 18px;
  }

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

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

  .rail,
  .results-pane {
    border-right: 0;
  }

  .results-pane,
  .detail-pane {
    max-height: none;
  }

  .detail-section,
  .fact-grid {
    grid-template-columns: 1fr;
  }

  .identity h2 {
    font-size: 32px;
  }
}
