:root {
  --bg: #0b1220;
  --panel: #0f1b33;
  --card: #111f3d;
  --text: #e7eefc;
  --muted: #a8b3cc;
  --line: rgba(255,255,255,0.10);
  --chip: rgba(255,255,255,0.08);
  --chipActive: rgba(16,185,129,0.20);

  --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.app { height: 100%; display: flex; flex-direction: column; }

.topbar {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.00));
}

.topbar__title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.title { font-weight: 800; letter-spacing: 0.2px; font-size: 16px; }
.subtitle { font-size: 12px; color: var(--muted); }

.topbar__controls { margin-top: 10px; display: grid; gap: 10px; }

.search {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  outline: none;
}
.search::placeholder { color: rgba(231,238,252,0.55); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}
.chip--active { background: var(--chipActive); border-color: rgba(16,185,129,0.35); }

.main { position: relative; flex: 1; min-height: 0; }
.map { height: 100%; width: 100%; }
.map { position: relative; z-index: 0; }
.panel { z-index: 5000; }

/* Leaflet tweaks */
.leaflet-container { background: #0b1220; }
.leaflet-control-attribution { display: none; }

/* Panel (mobile bottom sheet + desktop side panel) */
.panel {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  background: rgba(15,27,51,0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  max-height: 70%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel--hidden { display: none; }

.panel__header {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.panel__handle {
  width: 46px;
  height: 5px;
  border-radius: 99px;
  background: rgba(255,255,255,0.22);
  margin: 0 auto;
}

.iconbtn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
}

.panel__body { padding: 12px; overflow: auto; }

.card {
  background: rgba(17,31,61,0.85);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.card + .card { margin-top: 10px; }

.row { display: flex; gap: 10px; align-items: center; }
.badge {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.06);
  font-size: 12px;
}
.badge img { width: 18px; height: 18px; border-radius: 4px; }

.h1 { font-weight: 800; font-size: 16px; margin: 10px 0 6px; }
.muted { color: var(--muted); font-size: 12px; }
.desc { white-space: pre-wrap; line-height: 1.35; }

.timeline {
  display: grid;
  gap: 8px;
}
.step {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255,255,255,0.04);
}
.step__top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.step__title { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.step__title img { width: 18px; height: 18px; border-radius: 4px; }
.step__time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.step__comment { margin-top: 8px; color: var(--text); }
.step__org { margin-top: 6px; color: var(--muted); font-size: 12px; }

/* skeleton */
.skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.11), rgba(255,255,255,0.06));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
.sk-title { height: 18px; width: 70%; margin-bottom: 10px; }
.sk-line { height: 12px; width: 100%; margin-top: 8px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Desktop layout: panel справа */
@media (min-width: 980px) {
  .topbar__controls { grid-template-columns: 1fr auto; align-items: center; }
  .chips { justify-content: flex-end; }

  .panel {
    top: 10px;
    bottom: 10px;
    left: auto;
    right: 10px;
    width: 420px;
    max-height: calc(100% - 20px);
  }
  .panel__handle { display: none; }
}