/* ============ TheftRadar UK ============ */
:root {
  --bg: #0b1220;
  --panel: rgba(13, 21, 38, 0.92);
  --panel-border: rgba(94, 118, 165, 0.25);
  --text: #e6edf7;
  --text-dim: #8fa1bd;
  --car: #22d3ee;        /* cyan — vehicles */
  --car-deep: #0e7490;
  --bike: #fbbf24;       /* amber — motorcycles */
  --bike-deep: #b45309;
  --danger: #f87171;
  --radius: 14px;
  --font: "Space Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

#map {
  position: fixed;
  inset: 0;
  background: #0b1220;
  z-index: 0;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ============ Left panel ============ */
.panel {
  position: fixed;
  top: 16px;
  left: 16px;
  bottom: 16px;
  /* Fluid: shrinks with the window instead of jumping to a bottom sheet */
  width: clamp(228px, 26vw, 330px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.panel.is-hidden {
  transform: translateX(-115%);
  opacity: 0;
  pointer-events: none;
}

.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-thumb { background: #2a3b5c; border-radius: 3px; }

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}
.brand h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0.02em;
}
.tagline {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}
.brand-mark {
  position: relative;
  width: 40px; height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #12233f, #0b1220 70%);
  border: 1px solid var(--panel-border);
}
.radar-dot {
  position: absolute;
  top: 50%; left: 50%;
  width: 8px; height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--car);
  box-shadow: 0 0 10px var(--car);
}
.radar-ring {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1px solid var(--car);
  opacity: 0.6;
  animation: ping 2.2s ease-out infinite;
}
@keyframes ping {
  0%   { transform: scale(0.35); opacity: 0.8; }
  100% { transform: scale(1);    opacity: 0; }
}

.panel-collapse {
  margin-left: auto;
  background: none;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text-dim);
  width: 28px; height: 28px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.panel-collapse:hover { color: var(--text); }

.panel-expand {
  position: fixed;
  top: 24px;
  left: 16px;
  z-index: 1001;
  width: 40px; height: 40px;
  font-size: 22px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(14px);
}

/* Toggles */
.toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 10px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.toggle .swatch {
  width: 11px; height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.35;
}
.swatch-car  { background: var(--car);  box-shadow: 0 0 8px var(--car); }
.swatch-bike { background: var(--bike); box-shadow: 0 0 8px var(--bike); }

.toggle.is-on { color: var(--text); }
.toggle.is-on .swatch { opacity: 1; }
.toggle-car.is-on  { border-color: rgba(34, 211, 238, 0.5);  background: rgba(34, 211, 238, 0.08); }
.toggle-bike.is-on { border-color: rgba(251, 191, 36, 0.5);  background: rgba(251, 191, 36, 0.08); }

.toggle-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
}

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stat {
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
}
.stat-num {
  display: block;
  font-size: 24px;
  font-weight: 700;
  font-family: var(--mono);
}
.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.stat-car  .stat-num { color: var(--car); }
.stat-bike .stat-num { color: var(--bike); }

/* Hotspots */
.hotspots h2, .recent h2 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.hotspot-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  counter-reset: spot;
}
.hotspot {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  counter-increment: spot;
}
.hotspot::before {
  content: counter(spot);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  width: 14px;
}
.hotspot-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hotspot-bar {
  display: flex;
  height: 6px;
  width: 90px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}
.hotspot-bar .bar-car  { background: var(--car); }
.hotspot-bar .bar-bike { background: var(--bike); }
.hotspot-total {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  width: 20px;
  text-align: right;
}

/* Recent */
.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--car);
  cursor: pointer;
  transition: background 0.15s ease;
}
.recent-item:hover { background: rgba(255, 255, 255, 0.07); }
.recent-item.is-bike { border-left-color: var(--bike); }
.recent-reg {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  background: #fff;
  color: #111;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.recent-meta {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-foot {
  margin-top: auto;
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid var(--panel-border);
  padding-top: 10px;
}
.panel-foot p { margin: 0; }

/* ============ Report button ============ */
.report-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  color: #081018;
  background: linear-gradient(135deg, var(--car), #67e8f9);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(34, 211, 238, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.report-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(34, 211, 238, 0.5);
}

/* ============ Modal ============ */
.modal-backdrop[hidden] { display: none; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 8, 16, 0.7);
  backdrop-filter: blur(4px);
}
.modal {
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  background: #0e1729;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-head h2 { margin: 0; font-size: 19px; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* Type picker */
.type-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border: none;
  padding: 0;
  margin: 0 0 14px;
}
.type-opt input { position: absolute; opacity: 0; }
.type-opt span {
  display: block;
  text-align: center;
  padding: 11px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s ease;
}
.type-opt-car input:checked + span {
  border-color: var(--car);
  background: rgba(34, 211, 238, 0.12);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--car) inset;
}
.type-opt-bike input:checked + span {
  border-color: var(--bike);
  background: rgba(251, 191, 36, 0.12);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--bike) inset;
}

/* Fields */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}
.field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}
.field input, .field textarea {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s ease;
}
.field input.mono { font-family: var(--mono); text-transform: uppercase; }
.field input:focus, .field textarea:focus { border-color: var(--car); }
.field textarea { resize: vertical; }
.field input[type="date"] { color-scheme: dark; }
.field input[type="file"] { padding: 8px; font-size: 13px; }

.image-preview {
  margin-top: 8px;
  max-width: 100%;
  max-height: 160px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--panel-border);
}

.geo-status {
  font-size: 12px;
  color: var(--car);
  min-height: 15px;
  margin: 0 0 8px;
}
.form-error {
  font-size: 13px;
  color: var(--danger);
  margin: 0 0 10px;
}

.submit-btn {
  width: 100%;
  padding: 13px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  color: #081018;
  background: linear-gradient(135deg, var(--car), #67e8f9);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.submit-btn:disabled { opacity: 0.5; cursor: wait; }

.share-modal { max-width: 460px; }
.share-lede {
  margin: -4px 0 14px;
  color: var(--text-dim);
  font-size: 14px;
}
.share-summary {
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}
.share-summary span { color: var(--text); font-weight: 600; }
.share-summary strong {
  color: var(--car);
  font-family: var(--mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.share-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.digest-actions {
  display: grid;
  grid-template-columns: minmax(90px, auto) minmax(110px, auto) minmax(190px, 1fr);
  align-items: stretch;
}
.digest-actions .mini-btn {
  min-height: 36px;
  width: 100%;
  white-space: normal;
  text-align: center;
  line-height: 1.2;
}
.public-share-actions { margin-top: 14px; }
.share-action-btn {
  flex: 1 1 130px;
  min-height: 42px;
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  cursor: pointer;
}
.share-action-btn:hover { background: rgba(255, 255, 255, 0.12); }
.share-primary {
  color: #081018;
  border-color: transparent;
  background: linear-gradient(135deg, var(--car), #67e8f9);
}

/* ============ Map markers ============ */
.pin { filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5)); }

.cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  color: #081018;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
}
.cluster-car {
  background: radial-gradient(circle at 35% 30%, #7deffb, var(--car) 60%, var(--car-deep));
  box-shadow: 0 0 0 6px rgba(34, 211, 238, 0.25), 0 4px 12px rgba(0,0,0,0.4);
}
.cluster-bike {
  background: radial-gradient(circle at 35% 30%, #fde68a, var(--bike) 60%, var(--bike-deep));
  box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.25), 0 4px 12px rgba(0,0,0,0.4);
}
/* Mixed cluster: conic split (set inline) + dark centre disc for the count */
.cluster-mixed {
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.14), 0 4px 12px rgba(0,0,0,0.4);
}
.cluster span {
  display: flex;
  align-items: center;
  justify-content: center;
}
.cluster-mixed span {
  width: 64%;
  height: 64%;
  border-radius: 50%;
  background: rgba(8, 16, 24, 0.88);
  color: #fff;
}

/* Popup */
.leaflet-popup-content-wrapper {
  background: #0e1729;
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.leaflet-popup-tip { background: #0e1729; }
.leaflet-popup-content { margin: 14px 16px; font-family: var(--font); }

.popup-card { min-width: 210px; }
.popup-type {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 6px;
}
.popup-type-car  { background: rgba(34, 211, 238, 0.15);  color: var(--car); }
.popup-type-bike { background: rgba(251, 191, 36, 0.15);  color: var(--bike); }
.popup-reg {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 15px;
  background: #ffd307;
  color: #111;
  padding: 2px 10px;
  border-radius: 5px;
  display: inline-block;
  margin-left: 6px;
  border: 1px solid #b99b00;
}
.popup-model { font-weight: 600; margin: 8px 0 2px; font-size: 14px; }
.popup-loc, .popup-date { font-size: 12px; color: var(--text-dim); margin: 2px 0; }
.popup-details { font-size: 12px; margin: 8px 0 0; color: var(--text); }
.popup-img {
  width: 100%;
  max-height: 130px;
  object-fit: cover;
  border-radius: 8px;
  margin-top: 8px;
}

/* Attribution readable on dark map */
.leaflet-control-attribution {
  background: rgba(13, 21, 38, 0.8) !important;
  color: var(--text-dim) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--car) !important; }
.leaflet-control-zoom a {
  background: var(--panel) !important;
  color: var(--text) !important;
  border-color: var(--panel-border) !important;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  background: #0e1729;
  border: 1px solid var(--car);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.25s ease;
}
.toast-error { border-color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============ Site navigation ============ */
.site-nav {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 4px;
  padding: 5px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.site-nav a {
  padding: 7px 15px;
  border-radius: 8px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: color 0.15s ease, background 0.15s ease;
}
.site-nav a:hover { color: var(--text); }
.site-nav a.active {
  background: rgba(34, 211, 238, 0.12);
  color: var(--car);
}

/* ============ Sub-pages (browse / stats / about) ============ */
.page-body {
  min-height: 100vh;
  background:
    radial-gradient(1000px 500px at 80% -10%, rgba(34, 211, 238, 0.07), transparent),
    radial-gradient(800px 400px at 10% 110%, rgba(251, 191, 36, 0.05), transparent),
    var(--bg);
}
.page-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 20px 70px;
}
.page-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 0 26px;
  flex-wrap: wrap;
}
.page-header .brand { text-decoration: none; color: inherit; }
.page-header .site-nav {
  position: static;
  transform: none;
  margin-left: auto;
  box-shadow: none;
}
.page-title { margin: 0 0 6px; font-size: 30px; }
.page-sub { margin: 0 0 26px; color: var(--text-dim); font-size: 15px; }

/* Browse toolbar */
.browse-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}
.search-box {
  flex: 1;
  min-width: 220px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 11px 14px;
  outline: none;
}
.search-box:focus { border-color: var(--car); }
.chip {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip.is-on { color: var(--text); }
.chip-all.is-on  { border-color: rgba(230, 237, 247, 0.5); background: rgba(255, 255, 255, 0.09); }
.chip-car.is-on  { border-color: rgba(34, 211, 238, 0.5); background: rgba(34, 211, 238, 0.1); }
.chip-bike.is-on { border-color: rgba(251, 191, 36, 0.5); background: rgba(251, 191, 36, 0.1); }
.browse-count { font-size: 13px; color: var(--text-dim); margin-left: auto; }

/* Report cards */
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 14px;
}
.report-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.report-card:hover { transform: translateY(-3px); }
.report-card.is-car:hover  { border-color: rgba(34, 211, 238, 0.5); }
.report-card.is-bike:hover { border-color: rgba(251, 191, 36, 0.5); }
.card-media {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  background: linear-gradient(160deg, #12233f, #0b1220);
  border-bottom: 1px solid var(--panel-border);
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-model { font-weight: 600; font-size: 15px; margin: 2px 0 0; }
.card-loc, .card-date { font-size: 12px; color: var(--text-dim); margin: 0; }
.card-details {
  font-size: 12px;
  color: var(--text-dim);
  margin: 4px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-link {
  margin-top: auto;
  padding-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--car);
  text-decoration: none;
}
.card-link:hover { text-decoration: underline; }
.empty-note { color: var(--text-dim); padding: 40px 0; text-align: center; }

/* Stats page */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.chart-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 18px;
}
.chart-card h3 {
  margin: 0 0 14px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
}
.chart-card.span-2 { grid-column: span 2; }
.chart-wrap { position: relative; height: 260px; }

/* About page */
.prose { max-width: 720px; }
.prose h2 { font-size: 20px; margin: 30px 0 10px; }
.prose p, .prose li { color: var(--text-dim); font-size: 15px; line-height: 1.65; }
.prose strong { color: var(--text); }
.prose .accent-car  { color: var(--car); font-weight: 600; }
.prose .accent-bike { color: var(--bike); font-weight: 600; }
.tip-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}
.tip-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px;
}
.tip-card h4 { margin: 0 0 8px; font-size: 15px; }
.tip-card ul { margin: 0; padding-left: 18px; }
.tip-card li { font-size: 13px; margin-bottom: 5px; }

/* ============ Responsive ============ */
/* The panel never leaves the left edge: it narrows with the window and its
   contents step down in scale, staying a compact sidebar on any screen. */
@media (max-width: 1100px) {
  .share-layout { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .digest-actions { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .chart-grid, .stat-cards, .tip-cards { grid-template-columns: 1fr 1fr; }
  .chart-card.span-2 { grid-column: span 2; }

  .panel { padding: 14px; gap: 11px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand h1 { font-size: 18px; }
  .tagline { font-size: 11px; }
  /* Not enough width for two side-by-side: stack the layer toggles */
  .toggles { grid-template-columns: 1fr; }
  .toggle { font-size: 12px; padding: 8px 10px; }
  .stat { padding: 9px 10px; }
  .stat-num { font-size: 19px; }
  .stat-label { font-size: 10px; }
  .hotspot { font-size: 12px; padding: 6px 8px; }
  .hotspot-bar { width: 56px; }
  .recent-item { padding: 6px 8px; }
  .recent-reg { font-size: 11px; }
  .recent-meta { font-size: 11px; }
  .panel-foot { font-size: 10px; }
}
@media (max-width: 720px) {
  .site-nav {
    top: 14px;
    left: 14px;
    transform: none;
    padding: 4px;
  }
  .site-nav a { padding: 6px 10px; font-size: 12px; }
  .page-header .site-nav { margin-left: 0; }
  .stat-cards, .chart-grid, .tip-cards { grid-template-columns: 1fr; }
  .chart-card.span-2 { grid-column: auto; }

  .panel {
    top: 62px; /* clear the nav pill */
    left: 12px;
    bottom: 12px;
    width: min(76vw, 300px);
    padding: 12px;
    gap: 10px;
  }
  .panel-expand { top: 62px; left: 12px; }
  .report-btn { top: 14px; right: 14px; padding: 10px 16px; font-size: 14px; }
  .field-row { grid-template-columns: 1fr; }
}

/* ============ Admin dashboard ============ */
.login-card {
  max-width: 400px;
  margin: 40px auto 0;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 26px;
}
.login-card h2 { margin: 0 0 6px; font-size: 20px; }
.login-hint { color: var(--text-dim); font-size: 13px; margin: 0 0 18px; }

.admin-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.admin-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.admin-tab.is-on { color: var(--text); border-color: rgba(34, 211, 238, 0.5); background: rgba(34, 211, 238, 0.08); }

.admin-notice {
  margin: -6px 0 18px;
  padding: 11px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  font-size: 13px;
  font-weight: 600;
}
.admin-notice[hidden] { display: none; }
.admin-notice-success {
  border-color: rgba(34, 197, 94, 0.38);
  background: rgba(34, 197, 94, 0.1);
}
.admin-notice-error {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.1);
  color: #fecaca;
}
.admin-notice a {
  color: var(--car);
  margin-left: 8px;
  white-space: nowrap;
}

.table-scroll { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--panel-border); }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 860px;
}
.admin-table thead th {
  text-align: left;
  padding: 11px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--panel-border);
  white-space: nowrap;
}
.admin-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(94, 118, 165, 0.12);
  vertical-align: middle;
}
.admin-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.admin-table tr.row-hidden { opacity: 0.5; }

.raw-scroll {
  overflow: auto;
  max-height: 68vh;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}
.raw-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12px;
}
.raw-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 9px 10px;
  background: #111b30;
  color: var(--text);
  border-bottom: 1px solid var(--panel-border);
  white-space: nowrap;
}
.raw-table td {
  max-width: 240px;
  padding: 8px 10px;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(94, 118, 165, 0.12);
  border-right: 1px solid rgba(94, 118, 165, 0.08);
  vertical-align: top;
}
.raw-table td span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.raw-table tr:hover td {
  color: var(--text);
  background: rgba(34, 211, 238, 0.05);
}
.raw-actions {
  min-width: 150px;
  white-space: nowrap;
}
.raw-actions .mini-btn {
  margin-right: 6px;
  padding: 4px 8px;
  font-family: var(--font);
}
.raw-actions .mini-btn:last-child { margin-right: 0; }
.thumb {
  width: 40px; height: 32px;
  border-radius: 6px;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #12233f;
  font-size: 16px;
}
.thumb-none { border: 1px solid var(--panel-border); }
.ip-cell { color: var(--text-dim); font-size: 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
  max-width: 100%;
}
.badge-visible { background: rgba(34, 211, 238, 0.14); color: var(--car); }
.badge-hidden { background: rgba(148, 163, 184, 0.16); color: var(--text-dim); }
.badge-shared { background: rgba(34, 197, 94, 0.14); color: #86efac; }
.status-stack { display: flex; gap: 5px; flex-wrap: wrap; }

.share-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}
.share-box {
  min-width: 0;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
}
.integration-box {
  max-width: 680px;
}
.share-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.share-head > div {
  min-width: 0;
  flex: 1 1 220px;
}
.share-head .badge {
  flex: 0 1 auto;
}
.share-head h2 { margin: 0 0 4px; font-size: 18px; }
.share-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.connection-summary {
  display: grid;
  gap: 5px;
  margin: -2px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-size: 12px;
}
.connection-summary.is-connected {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
  color: var(--text);
}
.connection-summary strong { color: #86efac; }
.connection-summary code {
  color: var(--car);
  font-family: var(--mono);
  overflow-wrap: anywhere;
}
.share-form .submit-btn { margin-top: 4px; }
.share-textarea {
  width: 100%;
  min-height: 190px;
  margin-bottom: 12px;
  padding: 12px 14px;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  resize: vertical;
}
.empty-note.is-error { color: var(--danger); }

.row-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.mini-btn {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.mini-btn:hover { background: rgba(255, 255, 255, 0.12); }
.mini-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.mini-btn:disabled:hover { background: rgba(255, 255, 255, 0.06); }
.mini-share { color: var(--car); border-color: rgba(34, 211, 238, 0.38); }
.mini-share:hover { background: rgba(34, 211, 238, 0.12); }
.mini-danger { color: var(--danger); border-color: rgba(248, 113, 113, 0.4); }
.mini-danger:hover { background: rgba(248, 113, 113, 0.15); }

.bl-list, .audit-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
}
.audit-item {
  display: grid;
  grid-template-columns: 100px 130px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 9px 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  font-size: 13px;
}
.audit-action {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}
.audit-delete { background: rgba(248, 113, 113, 0.16); color: var(--danger); }
.audit-hidden { background: rgba(148, 163, 184, 0.16); color: var(--text-dim); }
.audit-visible, .audit-login { background: rgba(34, 211, 238, 0.14); color: var(--car); }
.audit-edit { background: rgba(251, 191, 36, 0.16); color: var(--bike); }
.audit-target { color: var(--text); }
.audit-detail { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-when { color: var(--text-dim); font-size: 12px; white-space: nowrap; }

.device-cell { color: var(--text-dim); font-size: 12px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-loc-current { font-size: 12px; color: var(--text-dim); align-self: center; padding: 10px 0; }

/* ---- Admin responsive: table becomes cards on narrow screens ---- */
@media (max-width: 760px) {
  .admin-tab { flex: 1; justify-content: center; padding: 9px 10px; font-size: 13px; }

  .table-scroll { overflow-x: visible; border: none; }
  .admin-table { min-width: 0; display: block; }
  .admin-table thead { display: none; }
  .admin-table tbody, .admin-table tr, .admin-table td { display: block; }
  .admin-table tr {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 12px;
  }
  .admin-table td {
    padding: 5px 0;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    text-align: right;
  }
  .admin-table td::before {
    content: attr(data-label);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    text-align: left;
    flex-shrink: 0;
  }
  .admin-table td[data-label=""] { justify-content: flex-start; }
  .admin-table td[data-label=""]::before { display: none; }
  .device-cell { max-width: none; }
  /* Actions: label on its own line, buttons wrap left-aligned below it so
     nothing (e.g. "Block IP") gets clipped on a narrow card. */
  .admin-table td.row-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
    padding-top: 8px;
  }
  .admin-table td.row-actions::before { flex-basis: 100%; }
  .mini-btn { flex: 0 0 auto; }
}

@media (max-width: 640px) {
  .audit-item { grid-template-columns: 1fr; gap: 4px; }
  .audit-when { justify-self: start; }
  .login-card { margin-top: 20px; padding: 20px; }
}
