/* ===================================================
   Rat Watch — Mobile-Only Design
   Bottom tab bar, single-column cards, full-screen modal,
   touch interactions, light mode only.
   =================================================== */

/* --- Custom Properties (Light Mode) --- */
:root {
  --bg: #F8F8FA;
  --sidebar-bg: rgba(255, 255, 255, 0.88);
  --card-bg: rgba(255, 255, 255, 0.6);
  --card-hover: rgba(255, 255, 255, 0.85);
  --border: rgba(0, 0, 0, 0.1);
  --border-hover: rgba(0, 0, 0, 0.16);

  --text-primary: #18181B;
  --text-secondary: #52525B;
  --text-muted: #71717A;

  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-light: rgba(37, 99, 235, 0.08);

  --danger: #F87171;
  --success: #34D399;

  --input-bg: rgba(0, 0, 0, 0.04);
  --input-border: rgba(0, 0, 0, 0.14);
  --input-focus: var(--accent);
  --input-focus-glow: rgba(37, 99, 235, 0.15);

  --modal-overlay: rgba(0, 0, 0, 0.25);
  --modal-bg: rgba(255, 255, 255, 0.85);

  --divider: rgba(0, 0, 0, 0.1);
  --scrollbar-thumb: rgba(0, 0, 0, 0.1);
  --scrollbar-track: transparent;

  --skeleton-base: rgba(0, 0, 0, 0.04);
  --skeleton-shine: rgba(0, 0, 0, 0.08);

  --category-drug: #16A34A;
  --category-drug-bg: rgba(22, 163, 74, 0.1);
  --category-violent: #DC2626;
  --category-violent-bg: rgba(220, 38, 38, 0.1);
  --category-property: #0891B2;
  --category-property-bg: rgba(8, 145, 178, 0.1);
  --category-dui: #D97706;
  --category-dui-bg: rgba(217, 119, 6, 0.1);
  --category-domestic: #7C3AED;
  --category-domestic-bg: rgba(124, 58, 237, 0.1);
  --category-sexual: #DB2777;
  --category-sexual-bg: rgba(219, 39, 119, 0.1);
  --category-court: #6B7280;
  --category-court-bg: rgba(107, 114, 128, 0.1);

  --active-badge-bg: rgba(248, 113, 113, 0.9);
  --active-badge-text: #fff;
  --released-badge-bg: rgba(52, 211, 153, 0.9);
  --released-badge-text: #fff;

  --toggle-track: rgba(0, 0, 0, 0.12);
  --toggle-knob: #fff;
  --toggle-active-track: var(--accent);

  --new-badge-bg: var(--accent);
  --new-badge-text: #fff;
  --bookmark-color: #D97706;

  --toast-bg: rgba(255, 255, 255, 0.9);
  --toast-text: #18181B;
  --toast-border: rgba(37, 99, 235, 0.12);

  --badge-repeat: var(--accent);
  --badge-repeat-bg: rgba(37, 99, 235, 0.12);

  --glass-blur: blur(20px);
  --glass-border: 1px solid rgba(0, 0, 0, 0.1);

  --navbar-height: 56px;
  --tab-bar-height: 56px;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background: linear-gradient(180deg, var(--bg) 0%, #E8E8EC 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }

/* --- App Shell Layout --- */
.app-shell {
  min-height: 100vh;
}

/* --- Navbar --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: var(--sidebar-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: var(--glass-border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 150;
  gap: 24px;
}

.navbar__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  text-decoration: none;
  margin-right: 8px;
}

.navbar__logo-img {
  height: 36px;
  width: auto;
}

.navbar__logo-icon {
  width: 22px;
  height: 22px;
  margin-right: 6px;
}

/* Bottom tab bar */
.navbar__links {
  display: flex;
  position: fixed;
  top: calc(100vh - var(--tab-bar-height));
  left: 0;
  right: 0;
  height: var(--tab-bar-height);
  background: var(--sidebar-bg);
  border-top: 1px solid var(--border);
  flex-direction: row;
  justify-content: space-around;
  padding: 0;
  gap: 0;
  z-index: 200;
}

.navbar__link {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  border-radius: 0;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}

.navbar__link--active {
  color: var(--accent);
}

.navbar__link-icon {
  display: block;
  width: 22px;
  height: 22px;
}

.navbar__link--filter-tab {
  display: flex;
}

.navbar__link-badge {
  background: var(--accent);
  color: var(--new-badge-text);
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* --- Navbar Search --- */
.navbar__search {
  flex: 1;
  min-width: 0;
  max-width: 320px;
  position: relative;
  display: flex;
  align-items: center;
}

.navbar__search-icon {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.navbar__search-input {
  width: 100%;
  height: 36px;
  padding: 0 34px 0 32px;
  border: 1px solid var(--input-border);
  border-radius: 18px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.navbar__search-input:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px var(--input-focus-glow);
}

.navbar__search-input::placeholder {
  color: var(--text-muted);
}

.navbar__search-clear {
  position: absolute;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  padding: 0;
}

.navbar__search-clear:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.06);
}

.navbar__search-clear--visible {
  display: flex;
}

/* --- Main Panel --- */
.main-panel {
  margin-top: var(--navbar-height);
  padding-bottom: calc(var(--tab-bar-height) + 8px);
  min-height: 100vh;
  position: relative;
}

/* --- Scroll Progress Bar --- */
.scroll-progress {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  z-index: 149;
  width: 0%;
  transition: width 0.1s linear;
}

/* --- Filter Drawer (full-width) --- */
.filter-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  height: 100vh;
  background: var(--sidebar-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-left: var(--glass-border);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.filter-drawer.open {
  transform: translateX(0);
}

.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 190;
}

.drawer-backdrop.active {
  display: block;
}

.filter-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 600;
}

.filter-drawer__close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 22px;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s;
}

.filter-drawer__close:hover {
  color: var(--text-primary);
}

.filter-drawer__body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filter-drawer__body--no-header {
  padding-top: 40px;
}

.filter-drawer__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-drawer__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.filter-drawer__search-wrap {
  position: relative;
}

.filter-drawer__search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.filter-drawer__input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.filter-drawer__input:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px var(--input-focus-glow);
}

.filter-drawer__input::placeholder {
  color: var(--text-muted);
}

.filter-drawer__select {
  width: 100%;
  padding: 10px 32px 10px 12px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%23a1a1aa' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s;
}

.filter-drawer__select:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px var(--input-focus-glow);
}

.filter-drawer__select option {
  background: var(--modal-bg);
  color: var(--text-primary);
}

.filter-drawer__toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  user-select: none;
}

.filter-drawer__toggle-label input { display: none; }

/* Toggle Switch */
.toggle-switch__track {
  width: 38px;
  height: 22px;
  background: var(--toggle-track);
  border-radius: 11px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--toggle-knob);
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

input:checked + .toggle-switch__track {
  background: var(--toggle-active-track);
}

input:checked + .toggle-switch__track::after {
  transform: translateX(16px);
}

/* --- Filter Drawer Chip Groups --- */
.filter-drawer__chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-drawer__chip {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.filter-drawer__chip:hover {
  border-color: var(--border-hover);
  background: var(--input-bg);
}

.filter-drawer__chip--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.filter-drawer__chip--active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* --- Filter Chips --- */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px;
}

.filter-chips:empty { display: none; }

.filter-chips:not(:empty) {
  padding-top: 12px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--accent-light);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s;
}

.filter-chip:hover {
  background: rgba(37, 99, 235, 0.15);
}

.filter-chip__close {
  font-size: 16px;
  padding: 2px 4px;
  line-height: 1;
  font-weight: 700;
  opacity: 0.7;
}

/* --- Category Chips (horizontal scroll) --- */
.category-chips {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-bottom: var(--glass-border);
  background: var(--sidebar-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  position: sticky;
  top: var(--navbar-height);
  z-index: 99;
}

.category-chips::-webkit-scrollbar { display: none; }

.category-chip {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.category-chip--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.35);
}

/* Category-specific tint on active */
.category-chip--active[data-category="Drug"],
.category-chip--active[data-category="Meth"],
.category-chip--active[data-category="Cocaine"],
.category-chip--active[data-category="Fentanyl"],
.category-chip--active[data-category="Heroin"],
.category-chip--active[data-category="Marijuana"],
.category-chip--active[data-category="Other Drugs"] {
  background: var(--category-drug);
  border-color: var(--category-drug);
  box-shadow: 0 2px 12px rgba(22, 163, 74, 0.35);
}

.category-chip--active[data-category="Violent"] {
  background: var(--category-violent);
  border-color: var(--category-violent);
  box-shadow: 0 2px 12px rgba(220, 38, 38, 0.35);
}

.category-chip--active[data-category="Property"] {
  background: var(--category-property);
  border-color: var(--category-property);
  box-shadow: 0 2px 12px rgba(8, 145, 178, 0.35);
}

.category-chip--active[data-category="DUI/Traffic"],
.category-chip--active[data-category="DUI"] {
  background: var(--category-dui);
  border-color: var(--category-dui);
  box-shadow: 0 2px 12px rgba(217, 119, 6, 0.35);
}

.category-chip--active[data-category="Domestic"] {
  background: var(--category-domestic);
  border-color: var(--category-domestic);
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.35);
}

.category-chip--active[data-category="Sexual"] {
  background: var(--category-sexual);
  border-color: var(--category-sexual);
  box-shadow: 0 2px 12px rgba(219, 39, 119, 0.35);
}

.category-chip--active[data-category="Court/Probation"],
.category-chip--active[data-category="Court"] {
  background: var(--category-court);
  border-color: var(--category-court);
  box-shadow: 0 2px 12px rgba(107, 114, 128, 0.35);
}

/* --- Feed Grid (single column) --- */
.feed-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 12px 8px calc(var(--tab-bar-height) + 20px);
}

.feed-grid--compact {
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 10px 6px calc(var(--tab-bar-height) + 16px);
}

/* Compact card adjustments */
.feed-grid--compact .inmate-card { border-radius: 10px; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15); }
.feed-grid--compact .inmate-card__photo-wrap { aspect-ratio: 3 / 4; }
.feed-grid--compact .inmate-card__name { font-size: 13px; }
.feed-grid--compact .inmate-card__charge { font-size: 11px; }
.feed-grid--compact .inmate-card__overlay { padding: 36px 10px 10px; }
.feed-grid--compact .inmate-card__hover-meta { padding: 6px 10px 8px; font-size: 11px; }
.feed-grid--compact .inmate-card__bookmark svg { width: 16px; height: 16px; }
.feed-grid--compact .inmate-card__accent { height: 3px; }

/* Hero card — first card gets dramatic treatment */
.feed-grid--compact .inmate-card--hero {
  grid-column: 1 / -1;
}
.feed-grid--compact .inmate-card--hero .inmate-card__photo-wrap { aspect-ratio: 3 / 4; }
.feed-grid--compact .inmate-card--hero .inmate-card__name { font-size: 17px; }
.feed-grid--compact .inmate-card--hero .inmate-card__charge { font-size: 13px; }
.feed-grid--compact .inmate-card--hero .inmate-card__overlay { padding: 48px 16px 16px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.82)); }

/* Hero in single-column (expanded) mode — nearly full-screen immersive */
.feed-grid:not(.feed-grid--compact) .inmate-card--hero .inmate-card__photo-wrap { aspect-ratio: 9 / 16; }

/* Staggered: every 5th card spans full width in compact mode */
.feed-grid--compact .inmate-card:nth-child(5n) { grid-column: 1 / -1; }
.feed-grid--compact .inmate-card:nth-child(5n) .inmate-card__photo-wrap { aspect-ratio: 16 / 9; }
.feed-grid--compact .inmate-card:nth-child(5n) .inmate-card__name { font-size: 17px; }
.feed-grid--compact .inmate-card:nth-child(5n) .inmate-card__charge { font-size: 13px; }
.feed-grid--compact .inmate-card:nth-child(5n) .inmate-card__overlay { padding: 48px 16px 16px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.82)); }

/* --- Inmate Card (Photo-Dominant, mobile defaults) --- */
.inmate-card {
  background: var(--card-bg);
  border: var(--glass-border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  position: relative;
  opacity: 0;
  animation: cardFadeIn 0.4s ease forwards;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.inmate-card:active { transform: scale(0.98); }

/* Photo wrap */
.inmate-card__photo-wrap {
  width: 100%;
  aspect-ratio: 4 / 5;
  background: rgba(0, 0, 0, 0.15);
  overflow: hidden;
  position: relative;
}

.inmate-card__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.inmate-card__photo--blur {
  filter: blur(12px);
  transform: scale(1.1);
}

.inmate-card__photo--loaded {
  filter: none;
  transform: scale(1);
  transition: filter 0.4s ease, transform 0.4s ease;
}

.inmate-card__no-photo {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--card-bg);
}

.inmate-card__no-photo-label {
  margin-top: 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0.4;
  text-transform: uppercase;
}

.inmate-card__no-photo svg {
  width: 48px;
  height: 48px;
  fill: currentColor;
  opacity: 0.15;
}

/* Gradient overlay at bottom of photo */
.inmate-card__overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 48px 16px 16px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  pointer-events: none;
  text-align: center;
}

.inmate-card__name {
  font-weight: 600;
  font-size: 17px;
  line-height: 1.3;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inmate-card__charge {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Meta always visible (no hover reveal) */
.inmate-card__hover-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 12px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-muted);
  max-height: 40px;
  opacity: 1;
  padding: 10px 16px 12px;
}

.inmate-card__bond {
  font-weight: 500;
  color: var(--text-secondary);
}

.inmate-card__held {
  color: var(--accent);
  font-weight: 500;
}

.inmate-card__held--released {
  color: var(--text-secondary);
  font-weight: 400;
}

/* Category accent line at bottom */
.inmate-card__accent {
  height: 4px;
  width: 100%;
}

/* Category color glow */
.inmate-card--cat-drug .inmate-card__accent { box-shadow: 0 -2px 8px rgba(22, 163, 74, 0.3); }
.inmate-card--cat-violent .inmate-card__accent { box-shadow: 0 -2px 8px rgba(220, 38, 38, 0.3); }
.inmate-card--cat-property .inmate-card__accent { box-shadow: 0 -2px 8px rgba(8, 145, 178, 0.3); }
.inmate-card--cat-dui-traffic .inmate-card__accent,
.inmate-card--cat-dui .inmate-card__accent { box-shadow: 0 -2px 8px rgba(217, 119, 6, 0.3); }
.inmate-card--cat-domestic .inmate-card__accent { box-shadow: 0 -2px 8px rgba(124, 58, 237, 0.3); }
.inmate-card--cat-sexual .inmate-card__accent { box-shadow: 0 -2px 8px rgba(219, 39, 119, 0.3); }
.inmate-card--cat-court-probation .inmate-card__accent,
.inmate-card--cat-court .inmate-card__accent { box-shadow: 0 -2px 8px rgba(107, 114, 128, 0.3); }

/* NEW badge */
.inmate-card__new-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--new-badge-bg);
  color: var(--new-badge-text);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  z-index: 2;
}

@keyframes newBadgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
}

.inmate-card__new-badge { animation: newBadgePulse 2s ease-in-out infinite; }

/* Bookmark icon — always visible */
.inmate-card__bookmark {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  z-index: 2;
  opacity: 1;
}

.inmate-card__bookmark--active {
  opacity: 1 !important;
  color: var(--bookmark-color);
  background: rgba(0, 0, 0, 0.5);
}

.inmate-card__bookmark svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Repeat badge */
.inmate-card__repeat-badge {
  position: absolute;
  bottom: 50px;
  right: 10px;
  background: rgba(0, 0, 0, 0.5);
  color: var(--accent);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  z-index: 2;
}

/* Category pill (used in watchlist cards) */
.category-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.4;
}

.category-pill--drug, .category-pill--meth, .category-pill--cocaine,
.category-pill--fentanyl, .category-pill--heroin, .category-pill--marijuana,
.category-pill--other-drugs {
  color: var(--category-drug);
  background: var(--category-drug-bg);
}
.category-pill--violent { color: var(--category-violent); background: var(--category-violent-bg); }
.category-pill--property { color: var(--category-property); background: var(--category-property-bg); }
.category-pill--dui-traffic, .category-pill--dui { color: var(--category-dui); background: var(--category-dui-bg); }
.category-pill--domestic { color: var(--category-domestic); background: var(--category-domestic-bg); }
.category-pill--sexual { color: var(--category-sexual); background: var(--category-sexual-bg); }
.category-pill--court-probation, .category-pill--court { color: var(--category-court); background: var(--category-court-bg); }

/* --- Skeleton Cards --- */
.skeleton-card {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
}

.skeleton-card__photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}

.skeleton-card__body { padding: 12px 14px 14px; }

.skeleton-card__line {
  height: 12px;
  background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: 6px;
  margin-bottom: 8px;
}

.skeleton-card__line--short { width: 60%; }
.skeleton-card__line--medium { width: 80%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Bottom Sheet --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Sheet container */
.sheet {
  background: var(--modal-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: 16px 16px 0 0;
  max-width: 100%;
  width: 100%;
  height: 75vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.3);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), height 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  position: relative;
}

.modal-overlay.active .sheet {
  transform: translateY(0);
}

.sheet--expanded { height: 95vh; }
.sheet--collapsed { height: 40vh; }
.sheet--dragging { transition: none !important; }

/* Drag handle */
.sheet__handle-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  cursor: grab;
  flex-shrink: 0;
  touch-action: none;
}

.sheet__handle-bar:active { cursor: grabbing; }

.sheet__handle {
  width: 36px;
  height: 4px;
  background: var(--text-muted);
  border-radius: 2px;
  opacity: 0.4;
}

/* Header (side-by-side mugshot + identity) */
.sheet__header {
  display: flex;
  gap: 16px;
  padding: 0 20px 12px;
  flex-shrink: 0;
  align-items: flex-start;
}

.sheet__mugshot {
  width: 72px;
  min-width: 72px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

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

/* No-photo placeholder inside mugshot */
.sheet__mugshot--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.sheet__mugshot--empty svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
  opacity: 0.25;
}

.sheet__identity {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
}

.sheet__name {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sheet__demographics {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Status badge (compact, fits beside name) */
.sheet__status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  align-self: flex-start;
}

.sheet__status-badge--active {
  background: var(--active-badge-bg);
  color: var(--active-badge-text);
}

.sheet__status-badge--released {
  background: var(--released-badge-bg);
  color: var(--released-badge-text);
}

/* Timeline (smaller thumbs) */
.sheet__timeline {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 20px 8px;
  flex-shrink: 0;
  scrollbar-width: none;
}

.sheet__timeline::-webkit-scrollbar { display: none; }
.sheet__timeline:empty { display: none; }

.sheet__timeline-thumb {
  width: 40px;
  height: 52px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.4;
  transition: all 0.25s ease;
}

.sheet__timeline-thumb--active {
  border-color: var(--accent);
  opacity: 1;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.3);
}

.sheet__timeline-thumb:hover {
  opacity: 0.8;
}

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

/* Scrollable body */
.sheet__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 20px 20px;
  min-height: 0;
}

/* Tabs (horizontal scroll pills, hidden when single booking) */
.sheet__tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex-shrink: 0;
  padding-bottom: 12px;
  scrollbar-width: none;
}

.sheet__tabs::-webkit-scrollbar { display: none; }
.sheet__tabs:empty { display: none; }

.sheet__tab {
  background: var(--input-bg);
  border: 1px solid var(--divider);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  flex-shrink: 0;
  font-family: inherit;
}

.sheet__tab:hover {
  background: var(--card-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.sheet__tab--active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* Booking meta */
.sheet__booking-meta {
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--divider);
}

.sheet__booking-meta:empty { display: none; }

.sheet__booking-date { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.sheet__booking-agency { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.sheet__booking-release { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* Charges (stacked cards instead of table) */
.sheet__charges {
  display: flex;
  flex-direction: column;
}

.charge-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
}

.charge-item:last-child { border-bottom: none; }

.charge-item__text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.charge-item__meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  gap: 10px;
}

.charge-item__meta:empty { display: none; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  bottom: calc(var(--tab-bar-height) + 12px);
  right: 16px;
  left: 16px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--toast-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--toast-text);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  border: var(--glass-border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast--out { animation: toastOut 0.25s ease forwards; }
.toast__icon { font-size: 16px; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(12px); }
}

/* --- Confetti --- */
.confetti-piece {
  position: fixed;
  width: 8px;
  height: 8px;
  z-index: 999;
  pointer-events: none;
  border-radius: 2px;
  animation: confettiFall 1.2s ease-out forwards;
}

@keyframes confettiFall {
  0% { opacity: 1; transform: translateY(0) rotate(0deg); }
  100% { opacity: 0; transform: translateY(300px) rotate(720deg); }
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.empty-state__icon { margin-bottom: 16px; opacity: 0.2; }

.empty-state__icon svg {
  width: 56px;
  height: 56px;
  fill: currentColor;
}

.empty-state__text { font-size: 16px; }

/* ===================================================
   Stats Page
   =================================================== */

.stats-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tab-bar-height) + 16px);
  width: 100%;
}

.stats-page__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.stats-page__title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stats-summary__card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}

.stats-summary__value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 32px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.1;
}

.stats-summary__label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 6px;
}

.stats-insights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.stats-insight {
  background: var(--accent-light);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.stats-insight::before {
  content: '\2022';
  color: var(--accent);
  font-weight: 700;
  margin-right: 8px;
}

.stats-section { margin-bottom: 36px; }

.stats-section__title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.chart-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.chart-card--full { grid-column: 1 / -1; }

.chart-card__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 16px;
}

.chart-card canvas {
  width: 100% !important;
  max-height: 300px;
}

/* Stats page filter select */
.stats-page .filter-select {
  padding: 10px 32px 10px 12px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%23a1a1aa' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s;
}

.stats-page .filter-select:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px var(--input-focus-glow);
}

.filter-select option {
  background: var(--modal-bg);
  color: var(--text-primary);
}

/* Heatmap */
.heatmap-container { overflow-x: auto; padding: 12px 0; }
.heatmap-grid { display: flex; gap: 3px; }
.heatmap-week { display: flex; flex-direction: column; gap: 3px; }

.heatmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--input-bg);
}

.heatmap-cell--1 { background: rgba(37, 99, 235, 0.15); }
.heatmap-cell--2 { background: rgba(37, 99, 235, 0.3); }
.heatmap-cell--3 { background: rgba(37, 99, 235, 0.5); }
.heatmap-cell--4 { background: rgba(37, 99, 235, 0.7); }
.heatmap-cell--5 { background: var(--accent); }

/* Leaderboard */
.leaderboard {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.leaderboard__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--divider);
  transition: background 0.15s;
}

.leaderboard__item:last-child { border-bottom: none; }

.leaderboard__rank {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 28px;
  text-align: center;
}

.leaderboard__photo {
  width: 42px;
  height: 50px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

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

.leaderboard__info { flex: 1; min-width: 0; }
.leaderboard__name { font-weight: 600; font-size: 14px; }

.leaderboard__charge {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard__count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 20px;
  font-weight: 500;
  color: var(--accent);
  min-width: 40px;
  text-align: center;
}

.leaderboard__count-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
}

/* ===================================================
   Watchlist Page
   =================================================== */

.watchlist-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tab-bar-height) + 16px);
  width: 100%;
}

.watchlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.watchlist-header__title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.watchlist-header__count {
  color: var(--text-muted);
  font-size: 14px;
  margin-left: 8px;
  font-weight: 400;
}

.watchlist-clear {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
}

.watchlist-clear:hover {
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* Watchlist uses single-column grid */
.watchlist-page .mugshot-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.watchlist-section {
  margin-bottom: 32px;
}

.watchlist-section__title {
  font-size: 18px;
  font-weight: 700;
  padding: 0 16px 12px;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color, var(--border));
  margin-bottom: 16px;
}

.watchlist-section__empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-secondary, #888);
  font-size: 14px;
}

.watchlist-empty {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

.watchlist-empty__icon { margin-bottom: 16px; opacity: 0.25; }
.watchlist-empty__icon svg { width: 56px; height: 56px; fill: currentColor; }
.watchlist-empty__text { font-size: 16px; margin-bottom: 8px; color: var(--text-secondary); }
.watchlist-empty__hint { font-size: 14px; color: var(--text-muted); }

/* --- Small phone refinements --- */
@media (max-width: 480px) {
  .feed-grid {
    gap: 12px;
    padding: 10px 6px calc(var(--tab-bar-height) + 16px);
  }

  .feed-grid--compact { gap: 8px; padding-left: 4px; padding-right: 4px; }

  .stats-summary { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stats-summary__value { font-size: 24px; }
}

/* Loading spinner */
.load-more-spinner {
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
}

.load-more-spinner::after {
  content: '';
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* --- Splash Screen --- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #F8F8FA;
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash__logo {
  height: 200px;
  width: auto;
  animation: splashPulse 0.75s ease-in-out infinite alternate;
}

@keyframes splashPulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 0px transparent);
  }
  100% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 30px rgba(37, 99, 235, 0.5));
  }
}

/* Exit: logo shrinks, then overlay fades */
.splash--exit .splash__logo {
  animation: splashShrink 0.3s ease-in forwards;
}

.splash--exit {
  animation: splashFade 0.5s ease-out 0.2s forwards;
}

@keyframes splashShrink {
  to {
    transform: scale(0.7);
    opacity: 0.5;
  }
}

@keyframes splashFade {
  to {
    opacity: 0;
    visibility: hidden;
  }
}
