:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #6b7686;
  --line: #e3e7ed;
  --accent: #2563eb;
  --green: #16a34a;
  --yellow: #d97706;
  --red: #dc2626;
  --grey: #8b95a3;
  --map-outside: #eef2f6;   /* фон вместо остального мира */
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
button { font: inherit; cursor: pointer; }

.top {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; white-space: nowrap; }
.crumbs { color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { flex: 1; position: relative; display: flex; min-height: 0; }
#map { flex: 1; background: var(--map-outside); }

.btn-ghost {
  background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; color: var(--text); white-space: nowrap;
}
.btn-ghost:hover { background: var(--bg); }
.btn-close { background: none; border: 0; font-size: 18px; color: var(--muted); padding: 4px 8px; }

/* ---------- правая панель ---------- */
.panel {
  width: 400px; max-width: 100%;
  background: var(--card); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
  animation: slide .2s ease-out;
}
.panel[hidden] { display: none; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; font-size: 18px; flex: 1; }
#view-list, #view-card { overflow-y: auto; flex: 1; }
#view-list { display: flex; flex-direction: column; }
#view-list[hidden], #view-card[hidden] { display: none; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.tab {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 6px 12px; font-size: 14px;
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab.zero:not(.active) { color: var(--muted); }
.tab[hidden] { display: none; }
/* категорий много — вкладки прокручиваются; flex-shrink:0, иначе список заведений их сплющивает */
.tabs { max-height: 132px; overflow-y: auto; flex-shrink: 0; gap: 5px; }
.tabs .tab { font-size: 13px; padding: 4px 10px; }
.search, .only-open { flex-shrink: 0; }
.btn-more {
  width: 100%; margin-top: 12px; padding: 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.v-phone { font-weight: 600; font-size: 14px; margin-top: 2px; }
.op { font-size: 13px; color: var(--text); }
.op.warn { color: var(--yellow); }
.op.real { color: var(--green); }
.ext { font-weight: 400; font-size: 13px; color: var(--muted); }
.phone-main { flex: 1; min-width: 0; }
.phone-main .phone { display: inline; }
.phone-main .op { margin-top: 2px; font-size: 14px; }
.op-note { color: var(--muted); font-size: 12px; margin: -2px 2px 8px; }

.search {
  margin: 12px 16px 0; padding: 8px 12px; font: inherit;
  border: 1px solid var(--line); border-radius: 8px;
}
.venues { padding: 8px 16px 16px; }
.venue {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--line); padding: 12px 0;
}
.venue:hover .v-name { color: var(--accent); }
.thumb {
  width: 52px; height: 52px; border-radius: 10px; flex-shrink: 0;
  background: var(--bg) center/cover no-repeat;
  display: grid; place-items: center; font-size: 24px;
}
.v-body { flex: 1; min-width: 0; }
.v-name { font-weight: 600; }
.v-sub { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }

/* ---------- статус ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; margin-top: 4px;
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.green { color: var(--green); }
.badge.yellow { color: var(--yellow); }
.badge.red { color: var(--red); }
.badge.grey { color: var(--grey); }
.flash { animation: flash 1s; }
@keyframes flash { 0% { background: #fff3c4; } 100% { background: transparent; } }

/* ---------- карточка заведения ---------- */
.card-photo {
  height: 190px; background: var(--bg) center/cover no-repeat;
  display: grid; place-items: center; font-size: 64px;
}
/* фото лежит поверх значка; пропало фото — виден значок */
.thumb, .card-photo { position: relative; overflow: hidden; }
.thumb img, .card-photo img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.row a { color: var(--accent); }
.card-body { padding: 16px; }
.card-body h3 { margin: 0 0 2px; font-size: 20px; }
.kind { color: var(--muted); margin-bottom: 12px; }
.row { display: flex; gap: 8px; color: var(--muted); margin: 4px 0; }
.phone-box {
  display: flex; align-items: center; gap: 8px;
  margin: 16px 0 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px;
}
.phone { font-size: 20px; font-weight: 700; flex: 1; color: var(--text); text-decoration: none; }
.btn-copy {
  background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px;
}
.btn-copy.done { background: var(--green); }
.status-big { padding: 10px 12px; border-radius: 10px; background: var(--bg); margin: 12px 0; }
.status-big .badge { font-size: 14px; margin: 0; }
.votes { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.btn-vote.noanswer { border-color: var(--yellow); color: var(--yellow); }
.btn-vote { font-size: 13px; padding: 10px 6px; }
.open-line { font-size: 13px; margin-top: 2px; }
.open-line.is-open { color: var(--green); }
.open-line.is-closed { color: var(--muted); }
.card-body .open-line { font-size: 14px; margin: 4px 0; }
.row.warn { color: var(--yellow); }
.votes.small .btn-vote { font-size: 12px; padding: 7px 4px; }
.btn-closed {
  width: 100%; margin-top: 8px; padding: 8px; border-radius: 10px; font-size: 13px;
  border: 1px dashed var(--line); background: none; color: var(--muted);
}
.btn-closed:hover { color: var(--red); border-color: var(--red); }
.block { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.block-title { font-weight: 600; margin-bottom: 4px; }
.sugg { margin-bottom: 12px; }
.sugg .phone { font-size: 17px; }
.btn-suggest {
  width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--accent);
  background: none; color: var(--accent);
}
.suggest-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.suggest-form[hidden] { display: none; }
.suggest-form input {
  flex: 1; min-width: 0; padding: 8px 12px; font: inherit;
  border: 1px solid var(--line); border-radius: 8px;
}
details.block summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.same { font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.muted { color: var(--muted); }
.only-open { display: flex; align-items: center; gap: 6px; margin: 8px 16px 0; font-size: 14px; color: var(--muted); }
.btn-vote { border-radius: 10px; padding: 10px; border: 1px solid; background: var(--card); }
.btn-vote.ok { border-color: var(--green); color: var(--green); }
.btn-vote.fail { border-color: var(--red); color: var(--red); }
.btn-vote:disabled { opacity: .5; cursor: default; }
.demo-note {
  margin-top: 16px; padding: 10px 12px; border-radius: 10px;
  background: #fff7e6; color: #8a5a00; font-size: 13px;
}
.source { color: var(--muted); font-size: 12px; margin-top: 12px; }

/* ---------- карта ---------- */
.city-label {
  background: rgba(255,255,255,.9); border: 0; box-shadow: 0 1px 3px rgba(0,0,0,.2);
  font-weight: 600; padding: 2px 6px;
}

/* ---------- оператор по номеру ---------- */
.phone-check {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.phone-check[hidden] { display: none; }
.phone-check input {
  width: 260px; max-width: 100%; padding: 8px 12px; font: inherit; font-size: 16px;
  border: 1px solid var(--line); border-radius: 8px;
}
.pc-label { font-weight: 600; font-size: 14px; white-space: nowrap; }
.pc-result { font-size: 14px; color: var(--muted); }
.pc-result.found, .pc-result.warn { color: var(--text); }
.pc-result.warn { color: var(--yellow); }
.pc-note { display: block; font-size: 12px; color: var(--muted); }

/* ---------- тревоги ---------- */
.alert-bar {
  background: #b91c1c; color: #fff; padding: 8px 16px; font-size: 14px;
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
}
.alert-bar[hidden] { display: none; }
.alert-bar b { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.alert-bar button {
  background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; padding: 2px 10px; font-size: 13px;
}
.alert-bar button:hover { background: rgba(255,255,255,.28); }
.alert-legend {
  position: absolute; left: 10px; bottom: 22px; z-index: 900; max-width: 420px;
  background: rgba(255,255,255,.93); border-radius: 10px; padding: 6px 10px; font-size: 12px;
  display: flex; flex-wrap: wrap; gap: 4px 12px; box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }
.sw.red { background: #dc2626; }
.sw.grey { background: #9ca3af; }
.sw.orange { background: #f97316; }
.region-alert.alert.monitoring { background: #ffedd5; color: #9a3412; }
.region-alert { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.region-alert.alert { background: #fee2e2; color: #991b1b; }
.region-alert.stale { background: #f3f4f6; color: #4b5563; }
.region-alert a { color: inherit; }
.region-alert.strip { margin: 0; border-radius: 0; padding: 8px 16px; border-bottom: 1px solid var(--line); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #1c2430; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 2000;
  max-width: calc(100% - 32px);
}

/* ---------- телефон ---------- */
@media (max-width: 700px) {
  .brand { display: none; }
  .panel {
    position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 65%;
    border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0;
    z-index: 1000; box-shadow: 0 -4px 20px rgba(0,0,0,.15);
  }
}
