
:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-alt: #f8fafb;
  --ink: #202326;
  --muted: #66717d;
  --line: #d8dee4;
  --line-strong: #c7d0d9;
  --accent: #256f68;
  --accent-dark: #1f5b55;
  --accent-soft: #e7f1ef;
  --warm: #9a5f24;
  --danger: #a13f3f;
}

* {
  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;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand-block {
  min-width: 0;
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.refresh-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 21px;
  font-weight: 720;
  letter-spacing: 0;
}

h2 {
  font-size: 15px;
  font-weight: 720;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

main {
  max-width: 1680px;
  margin: 0 auto;
  padding: 18px 24px 28px;
}

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

.metric {
  min-height: 76px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

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

.metric strong {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-size: 25px;
  line-height: 1;
}

.health-banner {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #d7aa52;
  border-radius: 6px;
  background: #fff7e8;
  color: #6d4b12;
  font-size: 13px;
  font-weight: 720;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  align-items: start;
}

.search-area,
.profile-area,
.lower-grid > section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(21, 30, 39, 0.04);
}

.searchbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.search-field {
  display: grid;
  gap: 5px;
}

.search-field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.filterbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
}

.metrics-filterbar {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

.coverage-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #f7fbfa;
}

.coverage-item {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.coverage-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.coverage-item strong {
  font-size: 14px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.filterbar label {
  display: grid;
  gap: 5px;
}

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

.hidden {
  display: none !important;
}

input,
select,
button,
.ghost-button,
.export-button {
  min-height: 38px;
  border-radius: 6px;
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
}

select {
  border: 1px solid var(--line);
  padding: 0 28px 0 10px;
  color: var(--ink);
  background: var(--surface);
}

input:focus {
  outline: 2px solid rgba(47, 118, 109, 0.22);
  border-color: var(--accent);
}

select:focus {
  outline: 2px solid rgba(47, 118, 109, 0.22);
  border-color: var(--accent);
}

button,
.export-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  padding: 0 14px;
  font-weight: 720;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.ghost-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  font-weight: 720;
  cursor: pointer;
}

button:hover,
.export-button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.ghost-button:hover {
  background: var(--surface-alt);
  border-color: var(--line-strong);
}

button:disabled {
  border-color: var(--line);
  background: #eef1eb;
  color: var(--muted);
  cursor: not-allowed;
}

.segments {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(118px, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}

.segments label {
  min-width: 0;
}

.segments input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segments span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  border-left: 1px solid var(--line);
  cursor: pointer;
}

.segments label:first-child span {
  border-left: 0;
}

.segments input:checked + span {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.pager {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
}

.page-size,
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-size span,
#pageInfo {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
  max-height: 610px;
}

.table-wrap.compact {
  max-height: 310px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  overflow-wrap: anywhere;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
  transition: background-color 120ms ease;
}

tbody tr:hover {
  background: #f3f7f6;
}

tbody tr.selected {
  background: var(--accent-soft);
}

.section-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
}

.section-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.directory-head {
  align-items: center;
}

.profile-area {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.profile-area .section-head {
  flex: 0 0 auto;
}

#profileBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.profile-body {
  padding: 14px;
}

.profile-title {
  margin-bottom: 12px;
}

.profile-title strong {
  display: block;
  font-size: 19px;
  line-height: 1.2;
}

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

.field-list {
  display: grid;
  gap: 9px;
}

.field {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 8px;
  font-size: 13px;
}

.field span:first-child {
  color: var(--muted);
  font-weight: 700;
}

.mini-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.mini-list h3 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0;
}

.mini-row {
  display: grid;
  gap: 2px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.mini-row strong {
  font-size: 13px;
}

.mini-row span {
  color: var(--muted);
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.review-action {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.review-action.reject {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.decision-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #eef6f3;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 760;
}

.watchlist-editor {
  display: grid;
  gap: 12px;
}

.watchlist-grid,
.watchlist-add-entity {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.watchlist-control {
  display: grid;
  gap: 5px;
}

.watchlist-control > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.switch-field {
  min-height: 38px;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.switch-field input,
.rule-toggle input {
  width: auto;
}

.rule-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.rule-toggle {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
}

.entity-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.entity-row .review-action {
  margin-top: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f4eadf;
  color: var(--warm);
  font-size: 12px;
  font-weight: 760;
}

.empty-state {
  padding: 28px 14px;
  color: var(--muted);
  font-size: 13px;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

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

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

@media (max-width: 980px) {
  .metrics,
  .workspace,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .profile-area {
    position: static;
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .top-actions,
  .export-button,
  .ghost-button {
    width: 100%;
  }

  main {
    padding: 14px;
  }

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

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

  .coverage-strip {
    grid-template-columns: 1fr 1fr;
  }

  .segments {
    width: 100%;
  }

  .segments label {
    min-width: 0;
  }

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

  .page-actions {
    align-items: stretch;
    flex-direction: column;
    justify-content: space-between;
  }

  .page-size {
    justify-content: space-between;
  }
}
