:root {
  --bg: #0b0e14; --card: #141a24; --line: #232c3b;
  --text: #e8edf4; --muted: #8b98ab; --accent: #e8590c; --accent2: #2f81f7;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 720px; margin: 0 auto; padding: 16px; }
.topnav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1000;
}
.brand { font-weight: 700; font-size: 18px; color: var(--text); }
.brand:hover { text-decoration: none; color: var(--accent); }
.btn {
  display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-weight: 600; cursor: pointer; font-size: 14px;
}
.btn:hover { text-decoration: none; filter: brightness(1.15); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { background: #7f1d1d; border-color: #a33; color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
h1 { font-size: 22px; margin: 8px 0 14px; }

.feed { display: grid; gap: 12px; }
.card {
  display: grid; grid-template-columns: 230px 1fr; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; color: var(--text);
}
.card:hover { border-color: var(--accent); text-decoration: none; }
.card-map { background: #0d1219; display: flex; align-items: center; justify-content: center; }
.card-body { padding: 10px 14px; }
.card-title { font-weight: 700; font-size: 16px; }
.card-date { color: var(--muted); font-size: 13px; }
.card-stats { display: flex; gap: 12px; margin-top: 6px; font-size: 14px; }
.src { font-size: 11px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); align-self: center; }
.empty { color: var(--muted); }

.walkmap { height: 400px; border-radius: 12px; border: 1px solid var(--line); z-index: 0; }
.recmap { height: 56vh; min-height: 300px; border-radius: 12px; border: 1px solid var(--line); z-index: 0; }
.rec-panel { margin-top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.rec-stats { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 12px; }
.rec-actions { display: flex; gap: 10px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 99px; background: #666; }
.dot.on { background: #2ea043; }
.dot.err { background: #d33; }

.stats { display: flex; gap: 14px; flex-wrap: wrap; margin: 16px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; min-width: 90px; }
.stat .num { font-size: 20px; font-weight: 700; }
.stat .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.stat .lbl { color: var(--muted); font-size: 12px; }
.meta { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.actions { display: flex; gap: 10px; }
.detail-head .back { font-size: 13px; }

.login-box { max-width: 360px; margin: 10vh auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.login-box input { width: 100%; padding: 10px; margin: 8px 0; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.login-box .btn { width: 100%; }
.err { color: #f88; }
.muted { color: var(--muted); }

@media (max-width: 560px) {
  .card { grid-template-columns: 1fr; }
  .card-map { justify-content: center; padding: 8px 0; }
}

/* photos */
.photostrip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; }
.ph { margin: 0; position: relative; flex: 0 0 auto; cursor: pointer; }
.ph img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.ph.unplaced img { opacity: .55; }
.ph-un { position: absolute; bottom: 3px; left: 3px; font-size: 9px; background: rgba(0,0,0,.65); padding: 0 5px; border-radius: 6px; color: #ffb; }
.ph-marker img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.5); display: block; }
.ph-marker { background: none; border: none; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 2000; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 94vw; max-height: 78vh; border-radius: 8px; }
.lb-close { position: absolute; top: 10px; right: 16px; font-size: 34px; color: #fff; background: none; border: none; cursor: pointer; }
.lb-cap { color: #ccc; margin-top: 10px; font-size: 13px; }

/* recorder: pending photos */
.rec-photos { display: flex; gap: 8px; overflow-x: auto; margin-top: 10px; }
.rec-photos .rp { position: relative; flex: 0 0 auto; }
.rec-photos img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.rec-photos .rp-up { position: absolute; top: -6px; right: -6px; font-size: 12px; color: #2ea043; }
.rec-photos .rp-err { position: absolute; top: -6px; right: -6px; font-size: 12px; color: #d33; }
