:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1f252d;
  --muted: #555f6b;
  --brand: #0a6e72;      /* darker logo teal: 6:1 contrast on white for links and buttons */
  --brand-dark: #08575a;
  --logo-teal: #0f9a9e;  /* logo colours (ukcrime.chat) */
  --charcoal: #2f3640;
  --accent: #ffdd00;
  --error: #b00020;
  --border: #d6dbe1;
  --notice-bg: #fff6d6;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; font-size: 1rem; }
a { color: var(--brand); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 5px var(--text);
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: #000; padding: .5rem 1rem; z-index: 2000; }
.skip-link:focus { left: 0; }

.site-header { background: #fff; color: var(--charcoal); border-bottom: 4px solid var(--logo-teal); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: .5rem 1.25rem; flex-wrap: wrap; padding-top: .5rem; padding-bottom: .5rem; }
.brand { display: inline-flex; align-items: center; text-decoration: none; border-radius: 4px; }
.brand img { display: block; height: 40px; width: auto; }
.site-header nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1rem; }
.site-header nav a, .site-header .link-button { color: var(--charcoal); text-decoration: none; font-weight: 600; }
.site-header .link-button { text-decoration: underline; }
.site-header nav a:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 4px; }
.site-header nav a[aria-current="page"] { color: var(--brand); text-decoration: underline; text-decoration-thickness: 3px; text-decoration-color: var(--logo-teal); text-underline-offset: 6px; }
@media (max-width: 600px) {
  .brand img { height: 32px; }
  .site-header nav ul { gap: .35rem .9rem; font-size: .95rem; }
}
.footer-brand { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem 1rem; font-size: 1rem; }
.footer-brand img { height: 28px; width: auto; }

main { padding-top: 1.5rem; padding-bottom: 2rem; }
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0 0 .25rem; }
h2 { font-size: 1.5rem; margin: 0; }
h3 { font-size: 1.1rem; margin: 0 0 .75rem; }
.lede { color: var(--muted); margin-top: 0; max-width: 60ch; }

.search-panel { background: var(--surface); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.search-form { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.field { display: flex; flex-direction: column; min-width: 200px; flex: 1 1 200px; }
.field-submit { flex: 0 0 auto; min-width: auto; padding-top: 1.6rem; }
label { font-weight: 600; margin-bottom: .25rem; }
input, select {
  font: inherit; padding: .6rem .7rem; border: 2px solid var(--text); border-radius: 6px; background: #fff; min-height: 44px;
}
input[aria-invalid="true"] { border-color: var(--error); }
button {
  font: inherit; font-weight: 600; background: var(--brand); color: #fff; border: 0; border-radius: 6px;
  padding: .65rem 1.25rem; min-height: 44px; cursor: pointer;
}
button:hover { background: var(--brand-dark); }
button[disabled] { opacity: .6; cursor: progress; }
.hint { color: var(--muted); font-size: .875rem; margin: .25rem 0 0; }
.error-text { color: var(--error); font-weight: 600; margin: .25rem 0 0; }

.status { margin: 1rem 0; min-height: 1.5rem; }
.status.error { background: #fde8eb; border-left: 5px solid var(--error); padding: .75rem 1rem; border-radius: 6px; }
.status.loading::before {
  content: ""; display: inline-block; width: 1em; height: 1em; margin-right: .5rem; vertical-align: -2px;
  border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .status.loading::before { animation: none; } }

.results-header { margin-bottom: 1rem; }
.results-header h2:focus { outline: none; }
.area-info { color: var(--muted); margin: .25rem 0 0; }
.notice { background: var(--notice-bg); border-left: 5px solid #c79a00; padding: .75rem 1rem; border-radius: 6px; }

.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.card { background: var(--surface); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); min-width: 0; }
.stat { display: flex; flex-direction: column; }
.stat-label { color: var(--muted); font-size: .9rem; }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1.2; }
.stat-value.small { font-size: 1.25rem; padding-top: .35rem; }
.stat-sub { color: var(--muted); font-size: .85rem; }

.grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (min-width: 900px) { .grid { grid-template-columns: 3fr 2fr; } }
#map { height: 460px; border-radius: 6px; border: 1px solid var(--border); }
.chart-wrap { position: relative; height: 460px; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.data-table th, .data-table td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--border); }
.data-table th { background: #eef1f5; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.swatch { display: inline-block; width: .8em; height: .8em; border-radius: 2px; margin-right: .5em; vertical-align: -1px; }
.streets-list { padding-left: 1.5rem; margin: 0; }
.streets-list li { margin-bottom: .25rem; }

.popup-title { font-weight: 700; margin-bottom: .25rem; }
.popup-list { margin: 0; padding-left: 1rem; max-height: 200px; overflow-y: auto; }

.site-footer { background: var(--charcoal); color: #e7e9ec; padding: 1.25rem 0; font-size: .875rem; }
.site-footer a { color: #fff; }

/* ---------- discussion boards ---------- */
.card + .card, .card + section, section.card { margin-bottom: 1rem; }
.narrow { max-width: 560px; margin: 0 auto 1rem; }
.prose { max-width: 820px; }
.prose h2 { margin-top: 1.5rem; }
.meta { color: var(--muted); font-size: .875rem; }
.button, a.button {
  display: inline-block; font-weight: 600; background: var(--brand); color: #fff; border-radius: 6px;
  padding: .65rem 1.1rem; text-decoration: none; min-height: 44px; line-height: 1.6;
}
a.button:hover { background: var(--brand-dark); }
button.small { padding: .35rem .75rem; min-height: 36px; font-size: .9rem; }
button.secondary { background: #fff; color: var(--brand); border: 2px solid var(--brand); }
button.secondary:hover { background: #eef1f5; }
button.danger { background: var(--error); }
button.danger:hover { background: #7f0017; }
.link-button { background: none; color: #fff; padding: 0; min-height: 0; text-decoration: underline; font-weight: 400; }
.link-button:hover { background: none; }
.inline-form { display: inline; }
.site-header nav ul { flex-wrap: wrap; align-items: center; }
.nav-user { display: flex; gap: .5rem; align-items: center; }
.flash { padding: .75rem 1rem; border-radius: 6px; margin: 0 0 1rem; border-left: 5px solid; }
.flash-success { background: #e6f4ea; border-color: #1e7e34; }
.flash-error { background: #fde8eb; border-color: var(--error); }
.flash-info { background: #e6f4f4; border-color: var(--brand); }
.stack-form { display: flex; flex-direction: column; gap: 1rem; }
.stack-form .field { min-width: 0; flex: none; }
.stack-form button[type=submit] { align-self: flex-start; }
textarea { font: inherit; padding: .6rem .7rem; border: 2px solid var(--text); border-radius: 6px; width: 100%; resize: vertical; }
textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 5px var(--text); }
.checkbox-field { flex-direction: row; flex-wrap: wrap; gap: .6rem; align-items: flex-start; }
.checkbox-field input { width: 1.4rem; height: 1.4rem; min-height: 0; margin-top: .15rem; }
.checkbox-field label { flex: 1; font-weight: 400; }
.checkbox-field .error-text { flex-basis: 100%; }
fieldset { border: 1px solid var(--border); border-radius: 6px; padding: .5rem .75rem; }
legend { font-weight: 600; padding: 0 .25rem; }
.radio { display: flex; gap: .5rem; align-items: flex-start; margin: .25rem 0; }
.radio input { min-height: 0; margin-top: .3rem; }
.radio label { font-weight: 400; margin: 0; }
.breadcrumbs { margin-bottom: .75rem; font-size: .95rem; }
.board-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.board-list { list-style: none; padding: 0; margin: 0; }
.board-list li { padding: .6rem 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; background: #e1e6ee; color: var(--text); border-radius: 999px; padding: .1rem .55rem; margin-left: .35rem; vertical-align: middle; }
.badge-warn { background: #ffe1a8; }
.thread-title { overflow-wrap: anywhere; }
.post-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.post { margin-bottom: 1rem; }
.post-meta { margin-bottom: .5rem; }
.post-body { overflow-wrap: anywhere; white-space: normal; margin: 0 0 .5rem; }
blockquote.post-body { border-left: 4px solid var(--border); padding-left: .75rem; margin-left: 0; }
.post-hidden { border: 2px dashed #c79a00; }
.removed { color: var(--muted); font-style: italic; }
.post-actions { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; border-top: 1px solid var(--border); padding-top: .5rem; }
.report summary { cursor: pointer; color: var(--brand); text-decoration: underline; padding: .25rem 0; }
.report[open] { flex-basis: 100%; }
.mod-tools button { margin-right: .25rem; }
.mod-form { display: flex; flex-direction: column; gap: .5rem; }
.button-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.report-item { border-top: 1px solid var(--border); padding: 1rem 0; }
.report-item h3 { margin-bottom: .25rem; }
.report-reasons { padding-left: 1.25rem; }
.pagination ul { list-style: none; display: flex; gap: .35rem; padding: 0; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-block; padding: .35rem .7rem; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.pagination span[aria-current] { background: var(--brand); color: #fff; border-color: var(--brand); }
.thread-mini { padding-left: 1.25rem; }
.thread-mini li { margin-bottom: .35rem; }
.grid-even { grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid-even { grid-template-columns: 1fr 1fr; } }
.user-card { background: #f7f8fa; border: 1px solid var(--border); border-radius: 6px; padding: .75rem; margin: .75rem 0; }
code { background: #eef1f5; padding: .1rem .3rem; border-radius: 4px; }
.mod-form .field, .user-card .field { flex: none; min-width: 0; }

/* ---------- Local crime news (v0.3) ---------- */
.news h3 { margin-top: 0; }
.news-list { list-style: none; margin: .75rem 0 0; padding: 0; }
.news-item { padding: .75rem 0; border-top: 1px solid var(--border); }
.news-item:first-child { border-top: 0; }
.news-title { font-weight: 600; }
.news-item .meta { margin-top: .15rem; font-size: .875rem; color: var(--muted); }
.news-snippet { margin: .3rem 0 0; font-size: .925rem; }
.news-ai { margin: .75rem 0; padding: .75rem 1rem; border-left: 4px solid #6b4fbb; background: #f4f1fb; border-radius: 6px; }
.news-ai .ai-label { margin: 0 0 .25rem; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #4a3590; }
.news-ai p { margin: .25rem 0; }
.news-ai details { font-size: .875rem; margin-top: .4rem; }
.news-credits { margin-top: .75rem; }
.news[aria-busy="true"] .news-meta::after { content: ""; display: inline-block; width: .8em; height: .8em; margin-left: .4em; border: 2px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: news-spin .8s linear infinite; vertical-align: -.1em; }
@keyframes news-spin { to { transform: rotate(360deg); } }
.badge-local { background: #e3f1e6; color: #1d5b2c; border-color: #b7dcc0; }
.badge-ai { background: #f4f1fb; color: #4a3590; border-color: #d9d0f2; }
@media (prefers-reduced-motion: reduce) { .news[aria-busy="true"] .news-meta::after { animation: none; } }

/* ---------- use my location (v0.6) ---------- */
.locate-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.locate-or { color: var(--muted); font-weight: 600; }
.locate-btn { display: inline-flex; align-items: center; gap: .5rem; }
.locate-btn[aria-busy="true"] .locate-icon { animation: locate-pulse 1s ease-in-out infinite; }
@keyframes locate-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .locate-btn[aria-busy="true"] .locate-icon { animation: none; } }
.locate-privacy { flex: 1 1 260px; margin: 0; }
.locate-status:empty { display: none; }
.locate-status { margin: .75rem 0 0; padding: .6rem .9rem; border-radius: 6px; background: #e6f4f4; border-left: 5px solid var(--brand); }
.locate-status.warn { background: var(--notice-bg); border-left-color: #c79a00; }
.locate-status.error { background: #fde8eb; border-left-color: var(--error); }
.auto-area { margin: .75rem 0 0; color: var(--muted); }
.auto-area strong { color: var(--text); }
.text-button { background: none; color: var(--brand); padding: 0 .25rem; min-height: 24px; font-weight: 600; text-decoration: underline; }
.text-button:hover { background: none; color: var(--brand-dark); }
