.detection-records {
  --records-accent: var(--brand, #18583f);
  --records-ink: var(--ink, #1c3027);
  --records-muted: var(--muted-ink, #4f6458);
  --records-line: #cedfd3;
  max-width: 760px;
  margin-inline: auto;
}

.detection-records [hidden] { display: none !important; }
.detection-records .records-connection { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: #fff3e1; color: #805311; font-size: 13px; }

.detection-records svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.detection-records :is(a, button, input, select):focus-visible,
.detection-records .records-count:focus-visible {
  outline: 2px solid var(--records-accent);
  outline-offset: 2px;
}

.detection-records .records-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 17px;
}

.detection-records h1 {
  color: var(--records-ink);
  font-size: 29px;
  letter-spacing: 0;
  line-height: 1.25;
}

.detection-records .records-new,
.detection-records .records-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  color: var(--records-accent);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.detection-records .record-buckets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 17px;
}

.detection-records .record-bucket {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  min-width: 0;
  min-height: 73px;
  padding: 8px clamp(7px, 2vw, 14px);
  border: 1px solid var(--records-line);
  border-radius: 13px;
  background: #fff;
  color: var(--records-muted);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}

.detection-records .record-bucket-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  min-height: 28px;
}

.detection-records .record-bucket strong {
  min-width: 0;
  color: var(--records-ink);
  font-size: clamp(16px, 4vw, 23px);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: normal;
  overflow-wrap: anywhere;
}

.detection-records .record-bucket[data-bucket="review"] svg { color: #9a611d; }
.detection-records .record-bucket[data-bucket="reviewed"] svg { color: #2d725e; }

.detection-records .record-bucket[aria-pressed="true"],
.detection-records .record-subfilters button[aria-pressed="true"],
.detection-records .records-unknown[aria-pressed="true"] {
  border-color: #94b7a4;
  background: var(--surface-muted, #eff5f0);
  color: var(--records-accent);
}

.detection-records .records-search {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--records-muted);
}

.detection-records .records-search > svg {
  position: absolute;
  left: 13px;
  pointer-events: none;
}

.detection-records .records-search input {
  min-height: 48px;
  padding: 9px 48px 9px 40px;
  border-color: var(--records-line);
  border-radius: 12px;
  background: #fff;
  font-size: 16px;
}

.detection-records .records-search input::placeholder { color: var(--records-muted); }
.detection-records .records-search input::-webkit-search-cancel-button { display: none; }

.detection-records .records-search button {
  position: absolute;
  right: 2px;
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
}

.detection-records .records-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 8px;
  margin-top: 5px;
}

.detection-records .records-options { display: flex; gap: 6px; }
.detection-records .records-options > span { position: relative; }

.detection-records .records-options select {
  appearance: none;
  width: 110px;
  min-height: 44px;
  padding: 8px 24px 8px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--records-ink);
  font-size: 16px;
  cursor: pointer;
}

.detection-records .records-options svg {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  color: var(--records-muted);
  pointer-events: none;
}

.detection-records .record-subfilters {
  position: relative;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #cedfd3 transparent;
  padding: 3px 3px 6px;
  margin: 0 -3px;
}

.detection-records .record-subfilters button,
.detection-records .records-unknown {
  min-height: 44px;
  padding: 6px 11px;
  border: 1px solid var(--records-line);
  border-radius: 999px;
  background: #fff;
  color: var(--records-muted);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
}

.detection-records .records-count {
  width: fit-content;
  margin: 7px 1px 8px;
  color: var(--records-muted);
  font-size: 12px;
}

.detection-records .record-list,
.detection-records .records-empty {
  margin: 0;
  padding: 0;
  border: 1px solid var(--records-line);
  border-radius: 16px;
  background: #fff;
  list-style: none;
}

.detection-records .record-list li + li { border-top: 1px solid var(--records-line); }

.detection-records .detection-record-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  min-height: 92px;
  padding: 13px;
  color: var(--records-ink);
}

.detection-records .detection-record-row:focus-visible { outline-offset: -3px; }
.detection-records li:first-child > .detection-record-row { border-radius: 15px 15px 0 0; }
.detection-records li:last-child > .detection-record-row { border-radius: 0 0 15px 15px; }
.detection-records li:only-child > .detection-record-row { border-radius: 15px; }

.detection-records .record-glyph {
  display: grid;
  place-items: center;
  width: 36px;
  height: 39px;
  border-radius: 10px;
  background: var(--surface-muted, #eff5f0);
  color: var(--brand, #18583f);
}

.detection-records .record-glyph-synthetic {
  background: #f0edf7;
  color: #695481;
}

.detection-records .record-description {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.detection-records :is(.record-name, .record-pack, .record-goal) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detection-records .record-name { font-size: 15px; font-weight: 650; }
.detection-records .record-pack,
.detection-records .record-meta { color: var(--records-muted); font-size: 11px; }
.detection-records .record-goal { color: var(--records-muted); font-size: 12px; }

.detection-records .record-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 8px;
  margin-top: 2px;
  line-height: 1.45;
}

.detection-records .record-source {
  padding: 1px 5px;
  border-radius: 4px;
  background: #f0edf7;
  color: #5f4a78;
  white-space: nowrap;
}

.detection-records .record-row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 7px;
  align-self: stretch;
  white-space: nowrap;
}

.detection-records .record-state {
  padding: 3px 7px;
  border-radius: 6px;
  background: #edf0f4;
  color: #4e6075;
  font-size: 11px;
  font-weight: 650;
}

.detection-records [data-tone="review"] .record-state { background: #fff1d9; color: #805311; }
.detection-records [data-tone="active"] .record-state { background: var(--surface-muted, #eff5f0); color: var(--brand, #18583f); }
.detection-records [data-tone="reviewed"] .record-state { background: #e8f3ef; color: #276652; }

.detection-records .record-row-action {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 24px;
  color: var(--records-accent);
  font-size: 12px;
  font-weight: 600;
}

.detection-records .record-row-action svg { width: 12px; height: 12px; }

.detection-records .records-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 26px 12px;
  color: var(--records-muted);
}

.detection-records .records-empty > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--surface-muted, #eff5f0);
}

.detection-records .records-empty strong { font-size: 14px; font-weight: 550; }
.detection-records .records-empty:has(.first-record-action:not([hidden])) {
  margin-top: 20px;
  padding: 40px 20px;
  background: white;
  border: 1px solid var(--records-line);
  border-radius: 18px;
  text-align: center;
}
.detection-records .first-record-help { font-size: 14px; line-height: 1.7; }
.detection-records .first-record-action { margin-top: 6px; }

.detection-records .records-empty button,
.detection-records .records-more {
  border: 1px solid var(--records-line);
  border-radius: 10px;
  background: #fff;
  color: var(--records-accent);
  min-height: 44px;
  padding: 8px 15px;
  font-size: 13px;
}

.detection-records .records-more {
  display: flex;
  width: 100%;
  margin-top: 11px;
}

@media (hover: hover) {
  .detection-records .detection-record-row:hover,
  .detection-records .records-more:hover,
  .detection-records .records-empty button:hover { background: var(--surface-muted, #eff5f0); }
}

@media (max-width: 360px) {
  .detection-records h1 { font-size: 26px; }
  .detection-records .record-buckets { gap: 5px; }
  .detection-records .detection-record-row { padding: 10px; gap: 7px; }
  .detection-records .record-glyph { width: 28px; height: 33px; }
  .detection-records .record-meta { column-gap: 5px; }
}
