:root {
  --bg: #0f1720;
  --panel: #18222e;
  --panel2: #1f2c3a;
  --line: #2a3a4c;
  --text: #e6edf3;
  --muted: #93a4b5;
  --accent: #2dd4bf;
  --accent2: #0ea5e9;
  --danger: #ef4444;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.inline { display: inline; }
.muted { color: var(--muted); }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.brand { font-weight: 800; font-size: 18px; color: var(--text); }
.slogan-bar {
  flex: 1 1 240px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.topbar nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar nav a { color: var(--text); font-weight: 600; font-size: 14px; }
.topbar nav .cta { color: var(--bg); background: var(--accent); padding: 6px 12px; border-radius: 8px; }
.topbar nav .who { color: var(--muted); font-size: 13px; }

button.link {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font: inherit; padding: 0;
}
button.link:hover { color: var(--text); }
button.link.del:hover { color: var(--danger); }

.container { max-width: 1200px; margin: 0 auto; padding: 16px; }
h1, h2 { margin: 8px 0 16px; }

/* Cards / forms */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 480px;
}
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
input, select {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
}
button[type="submit"], .topbar nav .cta {
  cursor: pointer;
}
button[type="submit"] {
  background: var(--accent);
  color: #04201c;
  border: none;
  border-radius: 8px;
  padding: 11px 16px;
  font-weight: 700;
  font-size: 15px;
}
button[type="submit"]:disabled { opacity: .6; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.error {
  background: rgba(239,68,68,.12);
  border: 1px solid var(--danger);
  color: #fecaca;
  padding: 10px 12px;
  border-radius: 8px;
  max-width: 480px;
}

/* Login */
.login-wrap { max-width: 420px; margin: 8vh auto; text-align: center; }
.login-wrap .logo { font-size: 56px; }
.login-wrap h1 { margin: 4px 0; }
.slogan-big {
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 15px;
  margin: 6px 0 20px;
}
.login-card { text-align: left; margin: 0 auto; }

/* Filters */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.filters select { padding: 8px 10px; }
.chk { flex-direction: row; align-items: center; gap: 6px; color: var(--text); }
.reset { font-size: 13px; color: var(--muted); }

/* Gallery grid */
.empty { color: var(--muted); }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tile.nometa { opacity: .92; border-style: dashed; }
.thumb { position: relative; display: block; aspect-ratio: 1/1; background: #0a0f15; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,.7); color: #fde68a;
  font-size: 11px; padding: 3px 7px; border-radius: 6px;
}
.badge.private { left: auto; right: 8px; color: #a5b4fc; }
/* видео-плитка */
.videoph { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 48px; }
.playicon {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; padding-left: 4px; pointer-events: none;
}
.thumb.is-video img { filter: brightness(.85); }
.private-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--muted); cursor: pointer;
}
.private-toggle input { width: auto; }
.meta { padding: 10px; display: flex; flex-direction: column; gap: 7px; }
.row1 { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.date { color: var(--muted); }
.country { color: var(--text); }
.who2 { font-size: 12px; color: var(--muted); }
.coordbtn {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--accent);
  border-radius: 8px;
  padding: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.coordbtn.copied, .mini.copied { color: var(--bg); background: var(--accent); }
.links { display: flex; gap: 8px; }
.mini {
  flex: 1;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 7px;
  padding: 6px;
  font-size: 11.5px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.addcoords {
  display: block; text-align: center;
  background: rgba(14,165,233,.12);
  border: 1px solid var(--accent2);
  color: #7dd3fc;
  border-radius: 8px; padding: 8px; font-size: 13px;
}
.actions { display: flex; justify-content: flex-end; gap: 12px; padding-top: 2px; }
.act { color: var(--muted); }

/* Upload */
.upload-card { max-width: 560px; }
.preview { display: flex; flex-wrap: wrap; gap: 8px; }
.preview img, .preview video { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; }
.progress { color: var(--accent); font-weight: 600; }

.warn {
  background: rgba(234,179,8,.10);
  border: 1px solid #a16207;
  color: #fde68a;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.5;
}
.warn ul { margin: 8px 0 0; padding-left: 20px; }
.warn li { margin: 2px 0; }
.two-cols { display: flex; gap: 10px; }
.two-cols label { flex: 1; }

/* Edit */
.edit-wrap { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.edit-img { width: min(360px, 100%); border-radius: 12px; border: 1px solid var(--line); }
.edit-side { flex: 1; min-width: 280px; }

/* Users */
table.users { width: 100%; border-collapse: collapse; margin-top: 16px; }
table.users th, table.users td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
table.users tr.inactive { opacity: .5; }
.row-form { flex-direction: row; flex-wrap: wrap; align-items: center; max-width: none; }
.row-form input { flex: 1; min-width: 140px; }

/* Map */
.map-toolbar { display: flex; gap: 16px; align-items: center; margin: 4px 0 12px; flex-wrap: wrap; }
#map { height: 70vh; min-height: 420px; border-radius: 12px; border: 1px solid var(--line); }
.popup { width: 170px; text-align: center; }
.popup img { width: 100%; border-radius: 8px; margin-bottom: 6px; }
.popup .pdate { font-size: 12px; color: #333; margin-bottom: 6px; }
.leaflet-popup-content { margin: 10px; }

/* Мини-превью как маркеры на карте */
.thumb-marker { background: none; border: none; }
.thumb-marker img {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.45);
  display: block;
  cursor: pointer;
  transition: transform .12s ease;
}
.thumb-marker img:hover { transform: scale(1.12); }

@media (max-width: 640px) {
  .slogan-bar { order: 3; flex-basis: 100%; font-size: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
}
