/* Отвес — тёмный минималистичный интерфейс. */

:root {
  --bg: #121316;
  --panel: #17191D;
  --raise: #1F2227;
  --line: #2A2E35;
  --text: #E9EAEC;
  --muted: #8A9099;
  --accent: #F2C14E;   /* нет сайта */
  --work: #6EA8FE;     /* в работе */
  --ok: #4CC38A;       /* интересно */
  --off: #5A606A;      /* отказ / есть сайт */
  --side: 400px;
  --pad: 20px;
  --r: 8px;
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--panel);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
}

a { color: var(--text); text-decoration-color: var(--off); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Каркас ---------- */

.side {
  width: var(--side);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.map-wrap {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  left: var(--side);
  background: var(--bg);
}
.map { position: absolute; inset: 0; }

/* ---------- Шапка ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px var(--pad);
  border-bottom: 1px solid var(--line);
}

.logo { font-weight: 600; font-size: 16px; letter-spacing: 0.01em; }

.tabs { display: flex; gap: 2px; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--raise); color: var(--text); }

.tab-count { color: var(--muted); font-variant-numeric: tabular-nums; }
.tab-count.has { color: var(--accent); }

/* ---------- Кнопка и статус ---------- */

.controls { padding: 16px var(--pad); }

.btn-main {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: var(--r);
  background: var(--accent);
  color: #15130C;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.btn-main:hover { filter: brightness(1.08); }
.btn-main:disabled { opacity: 0.5; cursor: progress; }

.status { margin: 10px 0 0; color: var(--muted); font-size: 13px; }

.btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.4; cursor: default; }

/* ---------- Результаты ---------- */

.summary { margin: 0; padding: 0 var(--pad) 12px; color: var(--muted); }
.summary b { color: var(--text); font-weight: 600; font-size: 20px; margin-right: 4px; font-variant-numeric: tabular-nums; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 var(--pad) 12px;
}

.chip {
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { border-color: var(--text); color: var(--text); }
.chip .n { color: var(--off); margin-left: 3px; font-variant-numeric: tabular-nums; }

.filters {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px var(--pad);
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.input {
  flex: 1 1 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}
.input::placeholder { color: var(--off); }

.check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px 0 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
}
.check:has(input:checked) { color: var(--text); border-color: var(--muted); }
.check input { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); }

.select {
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12.5px;
}

.list { margin: 0; padding: 0; list-style: none; }

.biz {
  position: relative;
  padding: 12px var(--pad) 12px calc(var(--pad) + 14px);
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 110px;
}

/* Точка слева — тот же цвет, что метка на карте. */
.biz::before {
  content: "";
  position: absolute;
  left: var(--pad);
  top: 19px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.biz[data-status="checked"]::before, .biz[data-status="contacted"]::before { background: var(--work); }
.biz[data-status="interested"]::before { background: var(--ok); }
.biz[data-status="declined"]::before, .biz[data-status="hassite"]::before, .biz.has-site::before { background: var(--off); }

.biz.is-selected { background: var(--raise); }

.biz-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }

.biz-name { margin: 0; font-size: 14px; font-weight: 500; line-height: 1.4; }
.biz-name button { padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.biz-name button:hover { text-decoration: underline; text-underline-offset: 3px; }

.badge { flex: none; color: var(--muted); font-size: 12px; text-align: right; }
.badge-none, .badge-page { color: var(--accent); }

.biz-meta, .biz-hours { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.biz-contacts { display: flex; flex-wrap: wrap; gap: 2px 12px; margin: 6px 0 0; font-size: 13px; }

.biz-actions, .biz-work { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }

.act {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: none;
  cursor: pointer;
}
.act:hover { color: var(--text); border-color: var(--muted); }

.status-select {
  height: 26px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
}

.note {
  display: block;
  width: 100%;
  min-height: 56px;
  margin-top: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  resize: vertical;
}
.note-text { margin: 6px 0 0; color: var(--muted); font-size: 13px; white-space: pre-wrap; }

.more { display: block; width: calc(100% - 2 * var(--pad)); margin: 12px var(--pad); }
.empty { margin: 0; padding: 16px var(--pad); color: var(--muted); }

.leads-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px var(--pad);
  border-bottom: 1px solid var(--line);
}
.leads-head .summary { padding: 0; }

.foot { margin-top: auto; padding: 14px var(--pad); color: var(--off); font-size: 12px; }
.foot a { color: var(--muted); }

/* ---------- Карточка на карте ---------- */

.biz-popup { z-index: 4; }
.biz-popup .maplibregl-popup-content {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  max-height: 60vh;
  overflow-y: auto;
}
.biz-popup .maplibregl-popup-tip { display: none; }
.biz-popup .maplibregl-popup-close-button {
  width: 28px; height: 28px;
  font-size: 18px;
  color: var(--muted);
  z-index: 1;
}
.biz-popup .maplibregl-popup-close-button:hover { background: none; color: var(--text); }
.popup-list .biz { padding: 12px 14px 12px 28px; border-bottom: 0; background: none; }
.popup-list .biz::before { left: 14px; }
.popup-list .biz-head { padding-right: 22px; }

.maplibregl-ctrl-attrib { background: rgba(18, 19, 22, 0.7) !important; color: var(--muted); font: 11px/1.4 var(--font); }
.maplibregl-ctrl-attrib a { color: var(--muted); }
.maplibregl-ctrl-group { background: var(--panel); border: 1px solid var(--line); box-shadow: none !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line); }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) opacity(0.7); }

/* ---------- Телефон ---------- */

@media (max-width: 860px) {
  :root { --pad: 16px; }
  .side { width: 100%; border-right: 0; }
  .map-wrap {
    position: relative;
    inset: auto;
    height: 55vh;
    min-height: 300px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .summary:first-child { padding-top: 14px; }
  .results .summary { padding-top: 14px; }
}

.act-closed:hover { color: #FF8A7A; border-color: #FF8A7A; }

/* Иконки ВК и Telegram в карточке */
.soc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--off);
}
.soc svg { width: 16px; height: 16px; }
.soc:hover { color: var(--muted); border-color: var(--muted); }
.soc.known { color: var(--text); border-color: var(--muted); }
.soc.known:hover { color: var(--accent); border-color: var(--accent); }

/* Город и кнопка поиска в одну строку */
.search-row { display: flex; gap: 8px; }
.search-row .btn-main { flex: 1; }
.city-select { height: 44px; padding: 0 10px; font-size: 14px; color: var(--text); background: var(--raise); }

/* Ссылки на полный список вида бизнеса в 2ГИС и Яндексе */
.ext { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0 var(--pad) 12px; color: var(--muted); font-size: 12.5px; }

/* ---------- Кнопка «Добавить» в номера ---------- */
.biz-head { align-items: flex-start; }
.biz-side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.btn-add {
  height: 40px;
  min-width: 132px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--r);
  background: var(--accent);
  color: #15130C;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.btn-add:hover { filter: brightness(1.08); }
.btn-add.is-added { background: none; border: 1px solid var(--accent); color: var(--accent); }
.btn-add:disabled { background: var(--raise); color: var(--off); cursor: default; filter: none; }

/* ---------- Вкладка «Номера» ---------- */
.nums-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 16px var(--pad);
  border-bottom: 1px solid var(--line);
}
.nums-head .summary { flex: 1 1 100%; padding: 0; }
.nums-head .btn-main { flex: 1; width: auto; }
.nums-clear { height: 44px; }
.num-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px var(--pad);
  border-bottom: 1px solid var(--line);
}
.num-name { margin: 0; font-weight: 500; }
.num-phones { margin: 2px 0 0; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* Год данных Overture в карточке */
.biz-age { margin: 2px 0 0; color: var(--off); font-size: 12px; }
.biz-age.old { color: #D9A441; }

.biz-age.ok { color: var(--ok); }

.act-check { border-color: var(--accent); color: var(--accent); }

.num-acts { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

.nums-tip { margin: 0; padding: 10px var(--pad); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }

/* Длинное название без пробелов не должно выталкивать кнопку «Добавить» за экран */
.biz-head .biz-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }

/* ---------- ВКонтакте ---------- */
.vk-row { display: flex; gap: 8px; margin-top: 12px; }
.btn-vk {
  flex: 1;
  height: 40px;
  border: 0;
  border-radius: var(--r);
  background: #0077FF;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.btn-vk:hover { filter: brightness(1.1); }
.btn-vk:disabled { opacity: 0.5; cursor: progress; }
.vk-out { height: 40px; }
