:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --ink: #202124;
  --muted: #6d716f;
  --line: #deded8;
  --accent: #e54b4b;
  --blue: #2f6f9f;
  --green: #3b7c5a;
  --shadow: 0 10px 30px rgba(26, 28, 30, 0.08);
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 64px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  font-size: 19px;
  font-weight: 760;
}

nav {
  display: flex;
  gap: 8px;
}

nav a,
#resetButton,
.load-more-button {
  min-height: 34px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 760;
}

nav a[aria-current="page"] {
  border-color: var(--ink);
}

.summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

h1,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1;
}

.summary p,
.result-head p,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.metric-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
}

.metric {
  display: grid;
  min-width: 112px;
  gap: 2px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric strong {
  font-size: 18px;
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.filters {
  position: sticky;
  top: 64px;
  z-index: 9;
  display: grid;
  grid-template-columns: minmax(260px, 1.45fr) repeat(9, minmax(112px, 1fr));
  gap: 10px;
  padding: 14px 24px;
  background: rgba(247, 247, 245, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

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

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

input,
select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

main {
  padding: 22px 24px 42px;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

#resetButton {
  cursor: pointer;
}

.people-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}

.person-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.person-head strong {
  font-size: 15px;
}

.confidence {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.location,
.work-line {
  color: var(--muted);
  font-size: 13px;
}

.name-candidate {
  color: var(--green);
  font-size: 12px;
  font-weight: 760;
}

.summary-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  font-size: 14px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  padding: 6px 8px;
  background: #ecece6;
  border-radius: 999px;
  font-size: 12px;
}

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

.card-actions a {
  color: var(--blue);
  font-size: 13px;
  font-weight: 760;
}

.person-detail {
  display: grid;
  grid-column: 1 / -1;
  gap: 14px;
  max-width: 980px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.detail-top button,
.detail-top a {
  min-height: 36px;
  padding: 8px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 760;
}

.detail-title h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.person-section {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.person-section h2 {
  margin: 0;
  font-size: 17px;
}

.person-section p {
  margin: 0;
  line-height: 1.42;
}

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

.detail-rows div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  background: #f7f7f2;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-rows span {
  color: var(--muted);
  font-size: 12px;
}

.detail-rows strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.name-list {
  display: grid;
  gap: 8px;
}

.name-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  background: #f7f7f2;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.name-list strong,
.name-list span {
  overflow-wrap: anywhere;
}

.name-list strong {
  font-size: 14px;
}

.name-list span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.original-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.empty {
  padding: 44px 12px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

@media (max-width: 1180px) {
  .filters {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .topbar,
  .summary,
  .result-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .metric-row {
    justify-content: start;
  }

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

  main,
  .summary {
    padding-right: 12px;
    padding-left: 12px;
  }

  .people-list {
    grid-template-columns: 1fr;
  }

  .detail-top {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-rows {
    grid-template-columns: 1fr;
  }

  .name-list div {
    align-items: start;
    flex-direction: column;
  }

  .name-list span {
    text-align: left;
  }
}
