:root {
  --bg: #0f172a;
  --panel: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #b91c1c;
  --accent-hover: #991b1b;
  --border: #cbd5e1;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: linear-gradient(145deg, #0f172a 0%, #1c1917 42%, #7f1d1d 100%);
}

.app-header {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) auto minmax(8rem, 1fr);
  align-items: start;
  gap: 1rem;
  padding: 1.25rem 1.5rem 0.75rem;
  color: #f1f5f9;
}

.app-header__center {
  text-align: center;
  justify-self: center;
  min-width: 0;
}

.app-header__center h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.15rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.15;
}

.title-3d {
  color: #f8fafc;
  text-shadow:
    1px 1px 0 #cbd5e1,
    2px 2px 0 #94a3b8,
    3px 3px 0 #64748b,
    4px 4px 0 #475569,
    5px 5px 8px rgba(0, 0, 0, 0.55);
}

.title-wanted {
  color: #ef4444;
  text-shadow:
    1px 1px 0 #dc2626,
    2px 2px 0 #b91c1c,
    3px 3px 0 #7f1d1d,
    4px 4px 0 #450a0a,
    5px 5px 10px rgba(0, 0, 0, 0.6);
}

.app-header__sub {
  margin: 0.3rem 0 0;
  color: #fff;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.back-link {
  color: #fecaca;
  text-decoration: none;
  font-size: 0.9rem;
  justify-self: start;
  align-self: center;
}

.back-link:hover { text-decoration: underline; }

.app-header__actions { justify-self: end; }

.app-root {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.5rem 1rem 2rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
  background: rgba(248, 250, 252, 0.96);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.9rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 8rem;
  flex: 1 1 8rem;
}

.field label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font: inherit;
  background: #fff;
}

.field--grow { flex: 2 1 14rem; }

.btn-row {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-ghost:hover { background: #cbd5e1; }

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  color: #fecaca;
  margin: 0.25rem 0 0.85rem;
  font-size: 0.92rem;
}

.status-bar strong { color: #fff; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem;
}

.card {
  background: var(--panel);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  padding: 0;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.card:hover { transform: translateY(-2px); }

.card__media {
  aspect-ratio: 4 / 5;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__placeholder {
  color: #94a3b8;
  font-size: 0.85rem;
  padding: 1rem;
  text-align: center;
}

.card__body {
  padding: 0.75rem 0.85rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
}

.badge-fbi {
  background: #1e3a8a;
  color: #dbeafe;
}

.card__title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.card__meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.empty,
.error,
.loading {
  background: rgba(248, 250, 252, 0.95);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
  color: #334155;
}

.error { color: #991b1b; background: #fee2e2; }

.disclaimer {
  max-width: 1180px;
  margin: 0 auto 1.5rem;
  padding: 0 1rem;
  color: #fecaca;
  font-size: 0.8rem;
  line-height: 1.45;
}

.record-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 40;
}

.record-modal-overlay.is-open { display: flex; }

.record-modal {
  width: min(720px, 100%);
  max-height: min(92dvh, 900px);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.record-modal__head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.record-modal__head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.record-modal__actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.record-modal__body { padding: 1rem; }

.detail {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 1rem;
}

.detail__photo {
  width: 100%;
  border-radius: 10px;
  background: #0f172a;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.detail dl {
  margin: 0;
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.35rem 0.75rem;
}

.detail dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.detail dd {
  margin: 0;
  font-size: 0.95rem;
}

.detail__block {
  margin-top: 0.85rem;
}

.detail__block h3 {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--muted);
}

.detail__block p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

@media (max-width: 700px) {
  .app-header {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .back-link { justify-self: center; }
  .detail { grid-template-columns: 1fr; }
  .detail__photo { max-width: 260px; margin: 0 auto; }
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}
