.targets-page {
  max-width: 58rem;
}

.target-controls {
  align-items: end;
  background: rgb(255 255 255 / 96%);
  border-bottom: 1px solid transparent;
  display: grid;
  gap: 0.7rem;
  grid-template-columns: minmax(12rem, 1.45fr) minmax(8rem, 0.55fr) auto;
  margin-bottom: 1.2rem;
  padding: 0.55rem 0;
  position: sticky;
  top: 4rem;
  transition: background-color 160ms ease, border-color 160ms ease;
  z-index: 2;
}

.target-controls.is-stuck {
  background: rgb(245 245 245 / 97%);
  border-bottom-color: #ddd;
}

.target-family-field,
.target-search {
  display: grid;
  gap: 0.25rem;
}

.target-family-field {
  position: relative;
}

.target-family-field::after {
  border-bottom: 2px solid var(--muted);
  border-right: 2px solid var(--muted);
  content: "";
  height: 0.45rem;
  pointer-events: none;
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-70%) rotate(45deg);
  width: 0.45rem;
}

.target-family-field select,
.target-search input {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font: inherit;
  min-height: 2.7rem;
  padding: 0.5rem 0.85rem;
  width: 100%;
}

.target-family-field select {
  appearance: none;
  padding-right: 2.65rem;
}

.target-family-field select:focus,
.target-search input:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgb(89 157 214 / 28%);
  outline: 0;
}

.target-marked-toggle {
  align-items: center;
  color: var(--row-ink);
  cursor: pointer;
  display: flex;
  gap: 0.4rem;
  min-height: 2.7rem;
  padding: 0.4rem 0;
  white-space: nowrap;
}

.target-marked-toggle input {
  accent-color: var(--green);
  flex: 0 0 auto;
  margin: 0;
  width: auto;
}

.target-groups {
  display: grid;
  gap: 1.15rem;
}

.target-family-heading {
  color: var(--row-ink);
  font-size: clamp(1.7rem, 5vw, 2.25rem);
  margin: 1.2rem 0 -0.3rem;
}

.target-family-heading:first-child {
  margin-top: 0;
}

.target-group-heading {
  align-items: end;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 0.55rem;
}

.target-group-heading h3,
.target-group-heading p {
  margin-bottom: 0;
}

.target-group-heading h3 {
  color: var(--row-ink);
  font-size: 1rem;
}

.target-group-heading p,
.target-group-heading > span {
  color: var(--muted);
  font-size: 0.75rem;
}

.target-rows {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 7px 24px rgb(25 48 33 / 5%);
  overflow: hidden;
}

.target-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.6rem;
  grid-template-columns: 2.15rem minmax(0, 1fr) auto;
  min-height: 3.6rem;
  padding: 0.5rem 0.65rem;
}

.target-row:last-child {
  border-bottom: 0;
}

.target-mark {
  align-items: center;
  align-self: stretch;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: flex;
  justify-content: center;
  padding: 0;
  width: 2.15rem;
}

.target-mark span {
  background: var(--paper);
  border: 2px solid #ababab;
  border-radius: 50%;
  height: 0.85rem;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
  width: 0.85rem;
}

.target-mark:hover span,
.target-mark:focus-visible span {
  border-color: var(--brand-blue);
  transform: scale(1.15);
}

.target-mark.is-marked span {
  background: var(--gold);
  border-color: #b77f00;
}

.target-mark:disabled {
  cursor: wait;
  opacity: 0.55;
}

.target-row-main {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  min-width: 0;
  padding: 0.1rem;
  text-align: left;
}

.target-row-main h4 {
  color: var(--row-ink);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.3;
  margin: 0 0 0.18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-row-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.72rem;
  gap: 0.4rem;
  min-width: 0;
}

.target-row-meta > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-quick-add {
  border-radius: 8px;
  font-size: 0.78rem;
  min-height: 2.15rem;
  padding: 0.35rem 0.65rem;
  white-space: nowrap;
}

.target-inspector {
  background: var(--panel);
  border: 0;
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 55px rgb(23 32 27 / 18%);
  color: var(--ink);
  height: 100dvh;
  inset: 0 0 0 auto;
  margin: 0;
  max-width: min(30rem, 92vw);
  overflow: auto;
  padding: 1.25rem;
  width: 100%;
}

.target-inspector::backdrop {
  backdrop-filter: blur(1px);
  background: rgb(15 25 19 / 30%);
}

.target-inspector-heading {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.target-inspector-heading h2 {
  font-size: 1.25rem;
}

.target-detail-grid {
  display: grid;
  gap: 0.2rem 1rem;
  grid-template-columns: minmax(6.5rem, 0.8fr) minmax(0, 1.2fr);
}

.target-detail-grid > div {
  display: contents;
}

.target-detail-grid dt,
.target-detail-grid dd {
  border: 0;
  margin: 0;
  padding: 0.5rem 0;
}

.target-detail-grid dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.target-detail-grid dd {
  color: var(--row-ink);
  font-weight: 400;
  text-align: right;
}

.target-inspector-add {
  margin-top: 1rem;
  width: 100%;
}

.target-filter-empty {
  color: var(--muted);
  padding: 1.5rem 0;
  text-align: center;
}

.target-mark-status {
  color: #8a3d14;
  font-size: 0.78rem;
  margin: -0.7rem 0 0.8rem;
  min-height: 1.2em;
}

.target-detail-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 1rem;
  padding: 1rem;
}

@media (max-width: 640px) {
  .target-controls {
    align-items: end;
    grid-template-columns: minmax(0, 1fr) auto;
    top: 3.55rem;
  }

  .target-search {
    grid-column: 1 / -1;
  }

  .target-marked-toggle {
    justify-content: center;
    min-height: 2.7rem;
  }

  .target-inspector {
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -18px 55px rgb(23 32 27 / 20%);
    height: auto;
    inset: auto 0 0;
    margin: auto;
    max-height: 86dvh;
    max-width: none;
    padding: 1rem;
  }
}

@media (max-width: 460px) {
  .target-row {
    grid-template-columns: 1.8rem minmax(0, 1fr) 2.25rem;
  }

  .target-mark {
    width: 1.8rem;
  }

  .button.target-quick-add {
    border-radius: 50%;
    display: grid;
    font-size: 1.35rem;
    height: 2.25rem;
    min-height: 2.25rem;
    padding: 0;
    place-items: center;
    width: 2.25rem;
  }
}
