* { box-sizing: border-box; }
html, body, #map { height: 100%; margin: 0; }
body { font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #1c2230; }

.panel {
  position: absolute; top: 12px; left: 12px; z-index: 5000; width: 300px;
  background: #fff; border-radius: 14px; padding: 12px;
  box-shadow: 0 4px 24px rgba(20, 30, 60, .18);
}
.row { display: flex; gap: 8px; }
.seg { display: flex; flex: 1; background: #eef0f4; border-radius: 9px; padding: 2px; }
.seg button {
  flex: 1; border: 0; background: none; padding: 7px 0; border-radius: 7px;
  font: inherit; font-weight: 600; color: #5b6475; cursor: pointer;
}
.seg button.on { background: #fff; color: #1c2230; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.range { display: flex; align-items: center; gap: 6px; margin: 10px 2px 0; color: #5b6475; }
.step { display: flex; flex: 1; min-width: 0; border: 1px solid #c3c9d4; border-radius: 7px; overflow: hidden; }
.step input {
  flex: 1; min-width: 0; width: 0; border: 0; padding: 5px 2px; text-align: center;
  font: inherit; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield;
}
.step input::-webkit-outer-spin-button, .step input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step button { border: 0; background: #eef0f4; color: #5b6475; width: 26px; font-size: 10px; cursor: pointer; }
.step button:active { background: #dfe3ea; }
.toggle { display: none; }
.banks { margin: 8px 2px 0; }
#banksBtn {
  width: 100%; text-align: left; border: 1px solid #c3c9d4; border-radius: 7px; background: #fff;
  padding: 6px 8px; font: inherit; color: #1c2230; cursor: pointer;
}
#banksBtn::after { content: "▾"; float: right; color: #7a8394; }
#banksBtn.filtered { border-color: #0a8a3c; color: #0a8a3c; font-weight: 600; }
#banksBox { margin-top: 6px; padding: 6px 8px; border: 1px solid #eef0f4; border-radius: 7px; }
.banks-all { font-size: 12px; color: #7a8394; margin-bottom: 4px; }
.banks-all a { color: #2a6fdb; text-decoration: none; }
#banksList { max-height: 150px; overflow-y: auto; columns: 2; column-gap: 8px; font-size: 13px; }
#banksList label { display: block; padding: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; break-inside: avoid; }
.tabs { margin-top: 8px; }
.tabs button { padding: 5px 0; font-weight: 500; font-size: 13px; }
.chk { display: block; margin: 10px 2px 0; color: #5b6475; cursor: pointer; }

.best { margin: 12px 2px 4px; font-size: 13px; color: #5b6475; }
.best b { display: block; font-size: 30px; line-height: 1.1; color: #0a8a3c; font-variant-numeric: tabular-nums; }
.top { list-style: none; margin: 6px 0 0; padding: 0; max-height: 38vh; overflow: auto; }
.top li { display: flex; gap: 8px; padding: 6px 4px; border-top: 1px solid #eef0f4; cursor: pointer; border-radius: 6px; }
.top li:hover { background: #f5f7fa; }
.top .r { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 52px; }
.top .r.b { color: #0a8a3c; }
.top .a { flex: 1; min-width: 0; }
.top .a i { display: block; font-style: normal; font-size: 12px; color: #7a8394; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status, .src { margin-top: 8px; font-size: 12px; color: #7a8394; }
.src a { color: inherit; }
.src .nw { white-space: nowrap; }
.informer { display: inline-block; vertical-align: middle; margin-left: 4px; }
.informer img { display: block; border: 0; }

.reviews { margin: 8px 2px 0; }
#revBtn {
  width: 100%; text-align: left; border: 1px solid #c3c9d4; border-radius: 7px; background: #fff;
  padding: 6px 8px; font: inherit; color: #1c2230; cursor: pointer;
}
#revBtn::after { content: "▾"; float: right; color: #7a8394; }
#revBox { margin-top: 6px; padding: 6px 8px; border: 1px solid #eef0f4; border-radius: 7px; }
#revList { max-height: 170px; overflow-y: auto; font-size: 13px; }
#revList:empty { display: none; }
#revList p { margin: 0 0 8px; white-space: pre-line; overflow-wrap: anywhere; }
#revList b { display: block; font-size: 12px; font-weight: 600; color: #7a8394; }
#revForm input, #revForm textarea {
  display: block; width: 100%; margin-bottom: 6px; border: 1px solid #c3c9d4; border-radius: 7px;
  padding: 5px 8px; font: inherit; resize: vertical;
}
#revForm #revSite { position: absolute; left: -9999px; width: 1px; }
#revForm button {
  border: 0; border-radius: 7px; background: #0a8a3c; color: #fff; padding: 6px 12px;
  font: inherit; font-weight: 600; cursor: pointer;
}
#revForm button:disabled { opacity: .5; }
#revMsg { margin-left: 6px; font-size: 12px; color: #7a8394; }
#revMsg.err { color: #c0392b; }

/* метки на карте */
.pin {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  padding: 3px 7px; border-radius: 11px; border: 1px solid #c3c9d4; background: #fff;
  font: 600 12px/1.2 system-ui, sans-serif; color: #5b6475; font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25); cursor: pointer;
}
.pin.near { border-color: #0a8a3c; color: #0a8a3c; }
.pin.best { background: #0a8a3c; border-color: #06702f; color: #fff; font-size: 13px; }
.pin.cl { border-radius: 4px 11px 11px 4px; }
.pin.cl::after { content: attr(data-n); margin-left: 5px; font-weight: 400; opacity: .7; }

.bal { font: 13px/1.4 system-ui, sans-serif; min-width: 220px; }
.bal h3 { margin: 0 0 2px; font-size: 15px; }
.bal p { margin: 0 0 6px; color: #5b6475; }
.bal table { border-collapse: collapse; width: 100%; margin: 6px 0; font-variant-numeric: tabular-nums; }
.bal td, .bal th { padding: 2px 6px 2px 0; text-align: left; font-weight: 400; }
.bal th { color: #7a8394; font-size: 12px; }
.bal .book { font-size: 12px; } .bal .book a { font-weight: 600; font-size: 13px; }
.bal .closed { color: #c0392b; } .bal .opened { color: #0a8a3c; }

/* --- телефон: карта сверху, панель снизу; фильтры и список раскрываются кнопкой --- */
@media (max-width: 640px) {
  body { display: flex; flex-direction: column; }
  #map { flex: 1; height: auto; min-height: 35%; }
  .panel {
    position: static; width: auto; border-radius: 14px 14px 0 0; max-height: 65%; overflow-y: auto;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 12px rgba(20, 30, 60, .15);
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  }
  .row, .more { flex: 0 0 100%; }
  .best { flex: 1; margin: 0 2px; font-size: 12px; }
  .best b { font-size: 22px; }
  .toggle {
    display: block; border: 0; border-radius: 9px; background: #eef0f4; color: #1c2230;
    padding: 9px 12px; font: inherit; font-weight: 600;
  }
  .toggle::after { content: " ▴"; }
  .panel.open .toggle::after { content: " ▾"; }
  .more { display: none; }
  .panel.open .more { display: block; }
  .range { margin-top: 0; }
  .step input { font-size: 16px; }          /* меньше 16px — iPhone увеличивает страницу при вводе */
  .step button { width: 38px; font-size: 13px; }
  .seg button { padding: 9px 0; }
  .chk { padding: 3px 0; }
  #banksBtn, #revBtn { padding: 9px 10px; }
  #revForm input, #revForm textarea { font-size: 16px; }
  #banksList label { padding: 5px 0; }
  .top { max-height: 30vh; }
  .top li { padding: 9px 4px; }
  .src { font-size: 11px; }
}
