:root {
  color-scheme: dark;
  --bg: #0b0c0e;
  --panel: #14161a;
  --panel-hi: #1b1e24;
  --line: #262a31;
  --text: #f3f4f6;
  --muted: #8a909a;
  --accent: #b8f24a;
  --accent-dim: #7ba32c;
  --danger: #ff7a6b;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  padding-bottom: env(safe-area-inset-bottom);
}

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(0.75rem + env(safe-area-inset-top)) 1rem 0.75rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.counter {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

.refresh:hover:not(:disabled) {
  background: var(--panel-hi);
}
.refresh:disabled {
  opacity: 0.6;
  cursor: progress;
}

.refresh svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.refresh.busy svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.controls {
  position: sticky;
  top: 4.3rem;
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 0.75rem;
}

.search:focus-within {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgb(184 242 74 / 0.12);
}

.search svg {
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
}

.search input {
  flex: 1;
  min-width: 0;
  padding: 0.85rem 0.6rem;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
}

.search input::-webkit-search-cancel-button {
  display: none;
}

.search button {
  flex: none;
  width: 1.8rem;
  height: 1.8rem;
  border: 0;
  border-radius: 999px;
  background: var(--panel-hi);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.filters {
  display: flex;
  gap: 0.4rem;
}

.filters button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.filters button span {
  font-variant-numeric: tabular-nums;
  color: inherit;
  opacity: 0.75;
}

.filters button.active {
  color: var(--text);
  border-color: var(--accent-dim);
  background: rgb(184 242 74 / 0.1);
}

main {
  padding: 0.5rem 1rem 4rem;
}

#list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms ease, border-color 120ms ease;
}

.row:hover {
  background: var(--panel-hi);
}
.row.selected {
  border-color: var(--accent-dim);
  background: var(--panel-hi);
}

.row:active {
  transform: scale(0.995);
}

.tick {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  border: 1.5px solid #3a3f48;
  transition: background 120ms ease, border-color 120ms ease;
}

.tick svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: #0b0c0e;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.row.checked .tick {
  background: var(--accent);
  border-color: var(--accent);
}

.body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.name {
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note {
  color: var(--accent-dim);
}

.row.checked .name {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--accent-dim);
}
.row.checked .meta {
  opacity: 0.6;
}

.vitals {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  font-variant-numeric: tabular-nums;
}

.dob {
  font-size: 0.85rem;
  color: var(--text);
}

.age {
  font-size: 0.72rem;
  color: var(--muted);
}

.age.minor {
  padding: 0 0.3rem;
  border-radius: 999px;
  background: rgb(255 122 107 / 0.15);
  color: var(--danger);
  font-weight: 650;
}

.checked-at {
  font-size: 0.72rem;
  color: var(--accent-dim);
}

.row.checked .dob {
  opacity: 0.7;
}

.verdict {
  margin: 2rem auto;
  max-width: 34rem;
  padding: 1.25rem;
  text-align: center;
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  color: var(--muted);
}

.verdict.miss {
  border-color: #5a3232;
  background: rgb(255 122 107 / 0.07);
  color: var(--danger);
  font-size: 1.05rem;
}

.status {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom));
  font-size: 0.78rem;
  color: var(--muted);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

.error {
  color: var(--danger);
  text-align: right;
}

@media (max-width: 420px) {
  .brand h1 {
    font-size: 0.95rem;
  }
  .refresh span {
    display: none;
  }
  .refresh {
    padding: 0.55rem;
  }
  .row {
    padding: 0.75rem;
  }
}
