/* JET Dynamic Capacity — асфальт и дорожная разметка */
@import url('https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@75..125,400..900&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --asphalt: #1b1d21;
  --tarmac: #24272d;
  --pit: #15161a;
  --line: #383c44;
  --marking: #ffc53d;
  --marking-dim: #8a6d24;
  --chalk: #e9e7e1;
  --dim: #9a9891;
  --ok: #7fc98b;
  --hot: #e5684a;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Archivo', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; }

html, body { height: 100%; }

body {
  background: var(--asphalt);
  color: var(--chalk);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
}

a { color: inherit; }

/* ── каркас ─────────────────────────────── */
#app { display: flex; height: 100vh; }

.rail {
  width: 300px; min-width: 300px;
  background: var(--pit);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.rail-head {
  padding: 18px 16px 14px;
  border-bottom: 2px dashed var(--marking);
}

.rail-head h1 {
  font-weight: 900; font-stretch: 115%;
  font-size: 19px; letter-spacing: .02em;
  text-transform: uppercase;
}

.rail-head h1 span { color: var(--marking); }

.rail-head .sub {
  color: var(--dim); font-size: 12px; margin-top: 2px;
}

.city-list { overflow-y: auto; flex: 1; }

.city-item {
  width: 100%; text-align: left;
  padding: 10px 16px;
  background: none; border: 0; border-bottom: 1px solid #22242a;
  color: var(--chalk); font: inherit; cursor: pointer;
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  border-left: 4px solid transparent;
}

.city-item:hover { background: var(--tarmac); }

.city-item.active {
  border-left-color: var(--marking);
  background: var(--tarmac);
}

.city-item .n { font-weight: 700; }
.city-item .m { font-family: var(--mono); font-size: 12px; color: var(--dim); white-space: nowrap; }

.rail-foot {
  padding: 10px 16px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; color: var(--dim);
}

.rail-foot button {
  background: none; border: 1px solid var(--line); color: var(--dim);
  font: inherit; padding: 3px 10px; border-radius: 3px; cursor: pointer;
}

.rail-foot button:hover { color: var(--marking); border-color: var(--marking-dim); }

/* ── основная область ───────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.toolbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: var(--pit);
}

.toolbar h2 {
  font-size: 17px; font-weight: 800; font-stretch: 110%;
  text-transform: uppercase; letter-spacing: .03em;
  margin-right: auto;
}

.seg { display: flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }

.seg button {
  background: none; border: 0; color: var(--dim);
  font: 12px var(--mono); padding: 5px 12px; cursor: pointer;
}

.seg button.on { background: var(--marking); color: #1b1d21; font-weight: 600; }

.content { flex: 1; display: flex; overflow: hidden; }

#map { flex: 1; background: var(--pit); }

.panel {
  width: 46%; min-width: 480px; max-width: 720px;
  overflow-y: auto; border-left: 1px solid var(--line);
  background: var(--asphalt);
}

/* ── таблица точек ──────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
  position: sticky; top: 0; background: var(--pit);
  font: 600 11px var(--mono); color: var(--dim); text-transform: uppercase;
  text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line);
  cursor: pointer; white-space: nowrap;
}

thead th:first-child { text-align: left; }

tbody td {
  padding: 7px 10px; border-bottom: 1px solid #22242a;
  font-family: var(--mono); font-size: 12.5px; text-align: right; white-space: nowrap;
}

tbody td:first-child {
  font-family: var(--sans); font-size: 13px; text-align: left;
  max-width: 240px; overflow: hidden; text-overflow: ellipsis;
}

tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--tarmac); }
tbody tr.sel { background: var(--tarmac); box-shadow: inset 4px 0 0 var(--marking); }

.bay {
  display: inline-block; height: 9px; margin-left: 8px; vertical-align: baseline;
  background: repeating-linear-gradient(90deg,
    var(--marking) 0 6px, transparent 6px 9px);
  opacity: .85;
}

/* ── карточка точки ─────────────────────── */
.point-view { padding: 18px 20px 40px; }

.crumb {
  font: 11px var(--mono); color: var(--dim); text-transform: uppercase;
  margin-bottom: 6px; cursor: pointer;
}

.crumb:hover { color: var(--marking); }

.point-view h3 {
  font-size: 18px; font-weight: 800; margin-bottom: 2px;
}

.point-meta {
  font: 12px var(--mono); color: var(--dim); margin-bottom: 16px;
  display: flex; gap: 16px; flex-wrap: wrap;
}

.point-meta .cap { color: var(--marking); }

.chart-block { margin-bottom: 22px; }

.chart-block h4 {
  font: 600 11px var(--mono); color: var(--dim);
  text-transform: uppercase; letter-spacing: .06em;
  padding-bottom: 6px; margin-bottom: 10px;
  border-bottom: 2px dashed var(--line);
}

.chart-wrap { position: relative; height: 200px; }

.empty {
  padding: 60px 20px; text-align: center; color: var(--dim);
}

.empty .big { font-size: 15px; color: var(--chalk); margin-bottom: 6px; }

/* ── статус ─────────────────────────────── */
.badge {
  font: 11px var(--mono); padding: 2px 8px; border-radius: 3px;
  border: 1px solid var(--line); color: var(--dim);
}

.badge.live { color: var(--ok); border-color: var(--ok); }

.leaflet-container { font: 12px var(--mono); }

.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--tarmac); color: var(--chalk);
}

@media (max-width: 1100px) {
  .rail { width: 220px; min-width: 220px; }
  .panel { min-width: 380px; }
}

@media (max-width: 800px) {
  #app { flex-direction: column; }
  .rail { width: 100%; min-width: 0; max-height: 30vh; }
  .content { flex-direction: column; }
  #map { min-height: 240px; }
  .panel { width: 100%; max-width: none; min-width: 0; border-left: 0; border-top: 1px solid var(--line); }
}

@media (prefers-reduced-motion: no-preference) {
  .city-item, tbody tr { transition: background .12s ease; }
}
