:root {
	--bg: #070b14;
	--panel: #0f1626;
	--panel-2: #141d31;
	--line: #1f2a42;
	--text: #e6ebf5;
	--muted: #8a96ad;
	--blue: #3d8bff;
	--red: #ff2d4b;
	--s1: #7d8798;
	--s2: #49a8ff;
	--s3: #f5c400;
	--s4: #ff7a1a;
	--s5: #ff2d4b;
	--radius: 10px;
	color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Dark map from standard OSM tiles */
.leaflet-tile-pane { filter: invert(1) hue-rotate(185deg) brightness(.9) contrast(.9) saturate(.55); }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif; }
a { color: #8cc0ff; }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1, h2 { margin: 0; letter-spacing: .01em; }
h2 { font-size: 17px; }

/* Header -------------------------------------------------------------------------------- */
.top {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
	padding: 18px 20px;
	background: radial-gradient(ellipse at 15% 0%, rgba(61,139,255,.25), transparent 55%),
	            radial-gradient(ellipse at 85% 0%, rgba(255,45,75,.22), transparent 55%), var(--bg);
	border-bottom: 1px solid var(--line);
}
.brand h1 { font-size: 28px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; line-height: 0; }
.brand h1 a { display: inline-block; border-radius: 6px; }
.brand h1 a:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }
/* The logo sits in the header's blue/red light wash; a soft glow ties its yellow to the page. */
.brand h1 img { display: block; max-width: 100%; height: auto; filter: drop-shadow(0 2px 10px rgba(0,0,0,.55)) drop-shadow(0 0 14px rgba(247,208,56,.18)); }
.brand h1::after { content: ""; display: block; width: 64px; height: 3px; margin-top: 10px; background: linear-gradient(90deg, var(--blue) 50%, var(--red) 50%); }
.brand p { margin: 8px 0 0; color: var(--muted); max-width: 46ch; }
.accounts { display: flex; gap: 12px; flex-wrap: wrap; }
.acct { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); text-decoration: none; color: var(--text); }
.acct:hover { border-color: #33476d; }
.acct img { height: 52px; width: auto; border-radius: 6px; display: block; }
.acct span { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.acct b { color: var(--text); font-size: 14px; }

main { max-width: 1400px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }

/* Live ticker ----------------------------------------------------------------------------- */
.ticker { padding: 12px 14px; }
.ticker-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.ticker-head h2 { display: flex; align-items: center; gap: 8px; text-transform: uppercase; font-size: 14px; letter-spacing: .08em; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(255,45,75,.7); animation: live 1.6s infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 rgba(255,45,75,.7); } 70% { box-shadow: 0 0 0 9px rgba(255,45,75,0); } 100% { box-shadow: 0 0 0 0 rgba(255,45,75,0); } }
.ticker-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.trow {
	display: grid; grid-template-columns: 24px 62px minmax(0, 1.2fr) minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; align-items: center;
	padding: 5px 8px; border-radius: 6px; cursor: pointer; border-left: 3px solid var(--sev, var(--s1));
	background: var(--panel-2);
}
.trow:hover { background: #1a2540; }
.trow .ago { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.trow .type { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .addr, .trow .disp { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .disp { color: var(--muted); font-size: 13px; }
.trow.fresh { animation: fresh 2.5s ease-out; }
@keyframes fresh { 0% { background: rgba(255,45,75,.45); transform: translateY(-6px); opacity: 0; } 15% { opacity: 1; transform: none; } 100% { background: var(--panel-2); } }
.ico { width: 22px; height: 22px; border-radius: 4px; display: inline-block; vertical-align: middle; object-fit: cover; flex: none; }

/* Map & controls -------------------------------------------------------------------------- */
.mapwrap { overflow: hidden; }
.controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.ctl { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.ctl select, .ctl input[type=date] { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; color: var(--text); }
fieldset.ctl { border: 0; margin: 0; padding: 0; }
.seg { background: var(--panel-2); border: 1px solid var(--line) !important; border-radius: 8px; padding: 2px !important; gap: 0; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 4px 10px; border-radius: 6px; color: var(--muted); }
.seg input:checked + span { background: #23345a; color: var(--text); }
.seg input:focus-visible + span { outline: 2px solid var(--blue); }
.cities label { display: inline-flex; align-items: center; gap: 5px; color: var(--text); cursor: pointer; }
.btn { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; cursor: pointer; color: var(--text); }
.btn:hover { border-color: #33476d; }
.btn.sm { padding: 2px 8px; font-size: 13px; }
.btn.primary { background: #1d3a6e; border-color: #2c5299; }
#types-count { color: var(--muted); }

.map-and-types { display: flex; position: relative; }
#map { flex: 1; height: 62vh; min-height: 380px; background: #0a0f1a; }
.types-panel { width: 320px; border-left: 1px solid var(--line); display: flex; flex-direction: column; height: 62vh; min-height: 380px; background: var(--panel); }
.types-panel[hidden] { display: none; }
.types-head { padding: 10px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.types-head input { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
.quick { display: flex; flex-wrap: wrap; gap: 4px; }
.type-list { overflow-y: auto; padding: 4px 10px 10px; }
.type-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 10px 0 4px; display: flex; align-items: center; gap: 6px; }
.type-group h3 button { margin-left: auto; }
.type-row { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 14px; cursor: pointer; }
.type-row .n { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--s1); flex: none; }
.sw.s1 { background: var(--s1); } .sw.s2 { background: var(--s2); } .sw.s3 { background: var(--s3); } .sw.s4 { background: var(--s4); } .sw.s5 { background: var(--s5); }
.map-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

.leaflet-container { font: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 10px 12px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-control-attribution { background: rgba(7,11,20,.75) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: #8cc0ff !important; }
.pop h4 { margin: 0 0 4px; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.pop .meta { color: var(--muted); font-size: 13px; }
.pop .btn { margin-top: 8px; }
.pop-multi { max-height: 220px; overflow-y: auto; }
.pop-multi div { padding: 3px 0; border-bottom: 1px solid var(--line); cursor: pointer; }

/* Expanding ring for newly logged incidents */
.ping { position: relative; }
.ping i { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 3px solid var(--pc, var(--red)); animation: ping 2s ease-out 3 both; }
.ping i:nth-child(2) { animation-delay: .6s; }
.ping b { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--pc, var(--red)); box-shadow: 0 0 12px var(--pc, var(--red)); }
@keyframes ping { 0% { transform: scale(.4); opacity: 1; } 100% { transform: scale(9); opacity: 0; } }
.pick-ring { stroke-dasharray: 6 5; }

/* Incident list --------------------------------------------------------------------------- */
.list-section { padding: 12px 14px; }
.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.list-mode { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #1d2b4b; border: 1px solid #2c4170; border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 13px; }
.chip button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 6px; font-size: 15px; }
.inc-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.inc { background: var(--panel-2); border-radius: 8px; border-left: 3px solid var(--sev, var(--s1)); }
.inc-sum { display: grid; grid-template-columns: 24px minmax(0, 1.2fr) minmax(0, 1.5fr) minmax(0, 1fr) 150px; gap: 10px; align-items: center; padding: 8px 10px; cursor: pointer; width: 100%; text-align: left; background: none; border: 0; }
.inc-sum:hover { background: #1a2540; border-radius: 8px; }
.inc-sum .type { font-weight: 600; }
.inc-sum .disp, .inc-sum .when { color: var(--muted); font-size: 13px; }
.inc-sum .when { text-align: right; font-variant-numeric: tabular-nums; }
.inc-sum > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inc.new { animation: fresh 2.5s ease-out; }
.inc-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 14px; padding: 4px 12px 14px 44px; }
.inc-detail dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 14px; }
.inc-detail dt { color: var(--muted); }
.inc-detail dd { margin: 0; }
.mini { height: 240px; border-radius: 8px; border: 1px solid var(--line); }
.nomap { height: 240px; border-radius: 8px; border: 1px dashed var(--line); display: grid; place-items: center; color: var(--muted); text-align: center; padding: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.actions select { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.sevtag { display: inline-flex; align-items: center; gap: 5px; }
.sentinel { text-align: center; padding: 14px; }
.sentinel:empty { display: none; }
.list-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 4px; }
.list-tools input[type=search] { flex: 1 1 320px; min-width: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; }
.list-tools select { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; color: var(--text); }
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 0; font-size: 13px; }
.pager:empty { display: none; }
.pager.busy { opacity: .5; pointer-events: none; }
.pg-btns { display: inline-flex; align-items: center; gap: 6px; }
.btn:disabled { opacity: .4; cursor: default; }
.post { margin: 4px 0 6px; padding: 6px 10px; border-left: 3px solid #2c5299; background: rgba(61,139,255,.08); border-radius: 0 6px 6px 0; }
.post footer { font-size: 12px; color: var(--muted); margin-top: 3px; }
.pop .post { font-size: 13px; max-width: 290px; }
.foot { max-width: 1400px; margin: 0 auto; padding: 4px 16px 28px; }

@media (max-width: 860px) {
	.trow { grid-template-columns: 22px 54px minmax(0, 1fr); }
	.trow .addr { grid-column: 3; grid-row: 2; font-size: 13px; color: var(--muted); }
	.trow .disp { display: none; }
	.trow .type { grid-column: 3; }
	.inc-sum { grid-template-columns: 22px minmax(0, 1fr) auto; }
	.inc-sum .addr { grid-column: 2 / 4; grid-row: 2; font-size: 13px; color: var(--muted); }
	.inc-sum .disp { display: none; }
	.inc-detail { grid-template-columns: 1fr; padding-left: 12px; }
	.map-and-types { flex-direction: column; }
	.types-panel { width: auto; height: 46vh; border-left: 0; border-top: 1px solid var(--line); }
	#map { height: 56vh; }
}
@media (max-width: 520px) {
	main { padding: 10px; }
	.top { padding: 14px 16px; }
	.acct img { height: 40px; }
	.brand h1 img { width: 210px; }
	.controls { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
	.live-dot, .trow.fresh, .inc.new { animation: none; }
	.ping i { animation-iteration-count: 1; }
}
.pages { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; }
.pages a { padding: 6px 14px; border-radius: 7px; color: var(--muted); text-decoration: none; font-weight: 600; }
.pages a:hover { color: var(--text); }
.pages a[aria-current=page] { background: #23345a; color: var(--text); }

/* Marker for the call under the pointer in the ticker / list */
.hover-mark { position: relative; pointer-events: none; }
.hover-mark i { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; border: 2px solid var(--pc, #fff); animation: hover-ring 1.5s ease-out infinite both; }
.hover-mark i:nth-child(2) { animation-delay: .75s; }
.hover-mark b { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--pc, #fff); border: 2px solid #fff; box-shadow: 0 0 8px var(--pc, #fff); box-sizing: content-box; transform: translate(-2px, -2px); }
@keyframes hover-ring { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(3.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hover-mark i { animation: none; transform: scale(2); opacity: .6; } .hover-mark i:nth-child(2) { display: none; } }

/* Map trend layer */
.tr-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.tr-ramp { width: 90px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, rgb(47,179,68), rgb(138,150,173) 50%, rgb(230,76,76)); }
.trend-tip { position: absolute; z-index: 800; pointer-events: none; background: #18223a; border: 1px solid #2e3d61; border-radius: 8px; padding: 6px 9px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.5); white-space: nowrap; }
.trend-tip span { color: var(--muted); }
.trend-pop { border-collapse: collapse; margin-top: 6px; font-size: 13px; width: 100%; }
.trend-pop th { color: var(--muted); font-weight: 500; text-align: left; padding: 2px 6px 2px 0; }
.trend-pop td { padding: 2px 6px 2px 0; border-top: 1px solid var(--line); }
.trend-pop td:nth-child(n+2), .trend-pop th:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; }
.trend-pop .up { color: rgb(230,76,76); } .trend-pop .down { color: rgb(47,179,68); }
