:root {
  color-scheme: dark;
  --bg: #050a16;
  --bg-deep: #020611;
  --surface: #0d1627;
  --surface-2: #101b2f;
  --surface-hover: #14213a;
  --border: #33435f;
  --border-soft: #22314b;
  --text: #f5f8ff;
  --muted: #93a6c6;
  --muted-2: #6f82a3;
  --accent: #2d74ff;
  --accent-2: #5c96ff;
  --good: #58d1a9;
  --warn: #f7c66d;
  --danger: #ff6c7d;
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg-deep); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 18% -10%, rgba(47,116,255,.10), transparent 35%), linear-gradient(180deg, #050a16 0%, #030713 100%); color: var(--text); overflow-x: hidden; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }

.ambient { position: fixed; pointer-events: none; filter: blur(80px); opacity: .2; z-index: 0; }
.ambient-one { width: 360px; height: 360px; background: #245dcb; top: -220px; left: 8%; border-radius: 50%; }
.ambient-two { width: 280px; height: 280px; background: #163f85; right: -180px; top: 45%; border-radius: 50%; }

.shell { width: min(1500px, calc(100% - 36px)); margin: 0 auto; padding: 18px 0 40px; position: relative; z-index: 1; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 104px; padding: 10px 2px 18px; border-bottom: 1px solid rgba(75,95,130,.25); }
.brand { display: flex; align-items: center; gap: 22px; min-width: 0; }
.institution-logo { width: 255px; height: 88px; object-fit: contain; object-position: left center; flex: 0 0 auto; }
.brand-copy { padding-left: 20px; border-left: 1px solid rgba(117,139,174,.28); }
.eyebrow, .kicker { display: block; color: #7d94bc; font-size: 10px; font-weight: 800; letter-spacing: .17em; }
.brand h1 { margin: 3px 0 0; font-size: 19px; line-height: 1.1; letter-spacing: -.02em; }
.brand h1 strong { color: var(--accent-2); }
.sync-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 12px; border: 1px solid var(--border-soft); background: rgba(13,22,39,.78); border-radius: 999px; color: var(--muted); font-size: 12px; font-weight: 700; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 14px rgba(88,209,169,.6); }
.sync-pill.loading .sync-dot { background: var(--accent-2); animation: pulse 1s infinite alternate; }
.sync-pill.local .sync-dot { background: var(--warn); box-shadow: 0 0 14px rgba(247,198,109,.4); }
.sync-pill.error .sync-dot { background: var(--danger); box-shadow: 0 0 14px rgba(255,108,125,.4); }
@keyframes pulse { to { opacity: .35; } }

.hero { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 34px 2px 24px; }
.hero h2 { margin: 5px 0 6px; font-size: clamp(26px, 4vw, 40px); letter-spacing: -.04em; }
.subtitle { margin: 0; color: var(--muted); max-width: 760px; line-height: 1.55; font-size: 14px; }
.counter { min-width: 105px; text-align: right; }
.counter strong { display: block; font-size: 27px; line-height: 1; }
.counter span { display: block; margin-top: 5px; color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }

.toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) auto 46px; gap: 10px; margin-bottom: 15px; }
.search-wrap, .sort-wrap, .refresh-btn { min-height: 48px; border: 1px solid var(--border); background: rgba(13,22,39,.94); box-shadow: inset 0 1px rgba(255,255,255,.025); }
.search-wrap { display: flex; align-items: center; gap: 10px; padding: 0 13px; border-radius: var(--radius); transition: border-color .16s, box-shadow .16s, background .16s; }
.search-wrap:focus-within { border-color: #397eff; background: #101b2f; box-shadow: 0 0 0 3px rgba(45,116,255,.12); }
.search-icon { width: 20px; fill: var(--muted); flex: 0 0 auto; }
.search-wrap input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; font-weight: 650; }
.search-wrap input::placeholder { color: #7083a4; }
.shortcut { border: 1px solid #354663; background: #131f34; border-bottom-color: #465a7c; border-radius: 5px; padding: 2px 7px; color: #8fa4c6; font-size: 11px; font-family: inherit; }
.sort-wrap { display: flex; align-items: center; gap: 9px; padding: 0 8px 0 14px; border-radius: var(--radius); }
.sort-wrap > span { color: var(--muted-2); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.sort-wrap select { min-width: 142px; border: 0; outline: 0; color: var(--text); background: #131e32; border-radius: 8px; padding: 8px 10px; font-size: 13px; font-weight: 750; }
.refresh-btn { display: grid; place-items: center; border-radius: var(--radius); color: var(--muted); transition: background .16s, border-color .16s, color .16s; }
.refresh-btn:hover { background: var(--surface-hover); border-color: #486087; color: #fff; }
.refresh-btn svg { width: 20px; fill: currentColor; }
.refresh-btn.spinning svg { animation: rotate .7s linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }

.active-filter { display: flex; align-items: center; gap: 8px; margin: -3px 1px 13px; color: var(--muted-2); font-size: 12px; }
.active-filter strong { color: #dfe9fb; }
.active-filter button { border: 0; padding: 3px 7px; border-radius: 6px; background: #15223a; color: #8fb4ff; font-size: 11px; font-weight: 800; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 9px; align-items: stretch; }
.crime-card { min-height: 88px; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; padding: 13px 14px 12px; border: 1px solid var(--border); background: linear-gradient(180deg, rgba(16,27,47,.98), rgba(13,22,39,.98)); border-radius: 8px; box-shadow: inset 0 1px rgba(255,255,255,.025); transition: transform .13s ease, border-color .13s ease, background .13s ease; }
.crime-card:hover { transform: translateY(-1px); border-color: #4b6084; background: linear-gradient(180deg, #14213a, #101b2f); }
.crime-name { margin: 0; color: #f4f7fd; font-size: 13px; line-height: 1.35; letter-spacing: -.01em; font-weight: 800; }
.stats { display: flex; align-items: center; gap: 12px; color: #9eb0ce; min-width: 0; }
.stat { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: 12px; }
.stat svg { width: 15px; height: 15px; fill: #8197ba; flex: 0 0 auto; }
.stat small { font-size: 10px; color: #6e83a4; font-weight: 700; margin-left: -2px; }
.fine-stat { min-width: 0; }
.fine-value { overflow: hidden; text-overflow: ellipsis; }

.grid.loading .crime-card { pointer-events: none; }
.skeleton { min-height: 88px; border: 1px solid #253651; border-radius: 8px; background: linear-gradient(100deg, #0e1728 35%, #152139 50%, #0e1728 65%); background-size: 240% 100%; animation: shimmer 1.25s linear infinite; }
@keyframes shimmer { to { background-position-x: -240%; } }

.empty-state { padding: 70px 20px; text-align: center; color: var(--muted); }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 10px; border-radius: 12px; border: 1px solid var(--border-soft); background: var(--surface); color: #7187aa; font-size: 24px; }
.empty-state h3 { margin: 0 0 5px; color: #e9effa; font-size: 16px; }
.empty-state p { margin: 0; font-size: 13px; }

.error-state { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 15px; border: 1px solid rgba(255,108,125,.3); background: rgba(58,18,29,.35); border-radius: 10px; }
.error-icon { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid rgba(255,108,125,.4); border-radius: 9px; color: #ff8997; font-weight: 900; }
.error-state h3 { margin: 0 0 3px; font-size: 14px; }
.error-state p { margin: 0; color: #be91a0; font-size: 12px; }
.error-state button { margin-left: auto; border: 1px solid rgba(255,108,125,.35); background: rgba(255,108,125,.08); color: #ff9aa5; padding: 8px 11px; border-radius: 8px; font-size: 12px; font-weight: 800; }

footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 28px; padding: 16px 2px 0; border-top: 1px solid rgba(75,95,130,.2); color: #607493; font-size: 10px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.footer-actions { display: flex; align-items: center; gap: 18px; }
.footer-actions a { color: #7798cc; text-decoration: none; }
.footer-actions a:hover { color: #a7c5f5; }

/* API docs */
.api-shell { max-width: 1120px; }
.api-brand { text-decoration: none; }
.back-link { color: #8ba3c8; text-decoration: none; font-size: 12px; font-weight: 800; }
.api-hero { padding-bottom: 18px; }
.docs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 12px 0; }
.docs-card { border: 1px solid var(--border); background: linear-gradient(180deg, rgba(16,27,47,.98), rgba(13,22,39,.98)); border-radius: 10px; padding: 18px; margin-bottom: 12px; }
.docs-card h3 { margin: 5px 0 8px; font-size: 16px; }
.docs-card p { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.docs-card code { color: #b6cdf5; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.docs-card pre { overflow-x: auto; margin: 12px 0 0; padding: 14px; border: 1px solid var(--border-soft); border-radius: 8px; background: #070d19; }
.method { display: inline-flex; padding: 3px 7px; border-radius: 5px; background: rgba(88,209,169,.12); color: #77dfbd; font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.docs-note { border-left: 2px solid var(--warn); padding-left: 12px; color: #c2b18c !important; }

@media (max-width: 900px) {
  .institution-logo { width: 200px; height: 76px; }
  .brand-copy { padding-left: 14px; }
  .docs-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .shell { width: min(100% - 22px, 1500px); padding-top: 10px; }
  .topbar { align-items: flex-start; min-height: 86px; gap: 12px; }
  .brand { gap: 10px; }
  .institution-logo { width: 155px; height: 66px; }
  .brand-copy { padding-left: 10px; }
  .brand h1 { font-size: 16px; }
  .eyebrow { font-size: 8px; }
  .sync-pill { padding-inline: 9px; }
  .sync-pill span:last-child { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hero { align-items: flex-start; padding-top: 26px; }
  .counter { display: none; }
  .toolbar { grid-template-columns: 1fr 46px; }
  .search-wrap { grid-column: 1 / -1; }
  .sort-wrap { justify-content: space-between; }
  .sort-wrap select { flex: 1; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
  footer { flex-direction: column; align-items: flex-start; gap: 9px; }
  .footer-actions { flex-wrap: wrap; gap: 10px 16px; }
  .back-link { display: none; }
}

@media (max-width: 520px) {
  .brand-copy { display: none; }
  .institution-logo { width: 180px; height: 74px; }
  .sync-pill { font-size: 10px; }
  .hero h2 { font-size: 27px; }
  .grid { grid-template-columns: 1fr; }
  .crime-card { min-height: 82px; }
  .shortcut { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
