/* assistant-app — слой тем (нижняя навигация) + модуль «Заведения».
   Использует токены NOVA из styles.css (--bg, --bg-soft, --surface-2, --border,
   --text, --strong, --muted, --accent, --accent-soft, --on-accent, --buy, --sell,
   --r-card, --shadow-sm, --shadow-md). styles.css/main.js не изменяются. */

/* ── слой тем ─────────────────────────────────────────────── */
body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
.theme { display: none; }
.theme.theme--on { display: block; }

.themebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 22;
  display: flex; gap: 2px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(20,28,48,.05);
}
.themebar .tbtn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: 0; padding: 5px 4px; cursor: pointer;
  color: var(--muted); font: inherit; -webkit-tap-highlight-color: transparent;
  transition: color .15s;
}
.themebar .tbtn svg { display: block; }
.themebar .tbtn .tlbl { font-size: 11px; font-weight: 600; letter-spacing: .01em; }
.themebar .tbtn.on { color: var(--accent); }
.themebar .tbtn:active { transform: scale(.94); }

/* ── общий верхний бар темы (кроме трейдинга, у него свой) ── */
.pl-top {
  display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg); position: sticky; top: 0; z-index: 5;
}
.pl-top .pl-brand { display: inline-flex; align-items: center; gap: 8px; margin-right: auto; }
.pl-top .pl-logo {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #6a53f0); color: #fff;
  box-shadow: 0 2px 8px rgba(63,91,239,.35);
}
.pl-top .pl-title { font-weight: 800; font-size: 17px; letter-spacing: .04em; color: var(--strong); }
.pl-addbtn {
  background: var(--accent); color: var(--on-accent); border: 0; border-radius: 10px;
  font: inherit; font-size: 14px; font-weight: 600; padding: 8px 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.pl-addbtn:active { filter: brightness(.94); }

/* баннер-шапка «Заведений» (картинка вместо значка) */
.pl-top--banner { position: relative; display: block; padding: 0; border-bottom: 0;
  background: #4f63f2; padding-top: env(safe-area-inset-top); }
.pl-banner-img { display: block; width: 100%; height: 76px; object-fit: cover; }
.pl-banner-ov { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center;
  gap: 10px; padding: 0 16px 9px; }
.pl-banner-ov .pl-title { color: #fff; font-size: 19px; font-weight: 800; letter-spacing: .02em;
  margin-right: auto; text-shadow: 0 1px 10px rgba(10,16,48,.45); }
.pl-banner-ov .pl-addbtn { background: #fff; color: var(--accent); box-shadow: 0 2px 10px rgba(10,16,48,.28); }

/* контент темы «Заведения» скроллится под фикс-барами */
.pl-body { max-width: 720px; margin: 0 auto; padding: 14px 16px; }

/* карта */
.pl-map {
  height: 60vh; min-height: 320px; width: 100%;
  border-radius: var(--r-card); overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  background: var(--surface-2);
}
.pl-map-wrap { position: relative; }
.pl-fab {
  position: absolute; right: 12px; bottom: 12px; z-index: 500;
  height: 44px; padding: 0 16px; border-radius: 999px; border: 0;
  background: var(--accent); color: #fff; font: inherit; font-weight: 700; font-size: 14px;
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(63,91,239,.4);
}
.pl-fab:active { transform: scale(.96); }
.pl-locbtn {
  position: absolute; right: 12px; bottom: 66px; z-index: 500;
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-soft); color: var(--accent); display: grid; place-items: center; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.pl-maphint { color: var(--muted); font-size: 12px; margin: 10px 2px 4px; }

/* emoji-пин на карте (divIcon) */
.pl-pin-b {
  width: 32px; height: 32px; border-radius: 50% 50% 50% 2px; transform: rotate(45deg);
  background: var(--bg-soft); border: 2px solid var(--accent);
  display: grid; place-items: center; box-shadow: 0 3px 6px rgba(0,0,0,.3);
}
.pl-pin-b span { transform: rotate(-45deg); font-size: 16px; line-height: 1; }

/* список мест / ближайшие */
.pl-list { list-style: none; padding: 0; margin: 6px 0 0; }
.pl-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; margin-bottom: 10px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow-sm);
}
.pl-emoji { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 12px;
  background: var(--surface-2); display: grid; place-items: center; font-size: 20px; }
.pl-mid { flex: 1 1 auto; min-width: 0; cursor: pointer; }
.pl-name { font-weight: 700; font-size: 15px; color: var(--strong); }
.pl-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap; }
.pl-chip { font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: 999px; }
.pl-dist { margin-left: auto; text-align: right; flex: 0 0 auto; }
.pl-dist b { font-size: 15px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.pl-dist small { display: block; font-size: 10px; color: var(--muted); }
.pl-star { background: none; border: 0; cursor: pointer; font-size: 18px; padding: 2px; line-height: 1; color: #cbd2e0; }
.pl-star.on { color: #f5a623; }
.pl-del { background: none; border: 0; cursor: pointer; color: var(--sell); padding: 4px; line-height: 0; }
.pl-empty { color: var(--muted); text-align: center; padding: 40px 16px; font-size: 14px; }
.pl-empty .pe-ic { font-size: 34px; display: block; margin-bottom: 10px; }

/* «Рядом»: поиск адреса */
.pl-search { display: flex; gap: 8px; margin: 4px 0 14px; }
.pl-input {
  flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--strong); font: inherit; font-size: 15px; padding: 11px 13px;
}
.pl-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pl-input::placeholder { color: var(--muted); }
.pl-btn { background: var(--accent); color: var(--on-accent); border: 0; border-radius: 10px;
  font: inherit; font-weight: 700; font-size: 14px; padding: 0 16px; cursor: pointer; white-space: nowrap; }
.pl-btn:active { filter: brightness(.94); }
.pl-btn[disabled] { opacity: .55; cursor: default; }
.pl-found { color: var(--muted); font-size: 12px; margin: 0 0 10px; }

/* карточка оповещения о приближении */
.pl-alert { display: flex; align-items: center; gap: 12px; padding: 13px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--shadow-sm); margin-top: 8px; }
.pl-alert .a-mid { flex: 1; }
.pl-alert .a-name { font-weight: 700; font-size: 14.5px; color: var(--strong); }
.pl-alert .a-sub { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.pl-switch { width: 50px; height: 30px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); position: relative; flex: 0 0 auto; cursor: pointer; transition: background .18s; }
.pl-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.3); transition: left .18s; }
.pl-switch.on { background: var(--accent); border-color: var(--accent); }
.pl-switch.on::after { left: 24px; }
.pl-radius { display: flex; gap: 6px; margin-top: 12px; }
.pl-rchip { flex: 1; text-align: center; padding: 8px 4px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--muted);
  font-size: 13px; font-weight: 600; }
.pl-rchip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.pl-note { color: var(--muted); font-size: 12px; margin: 14px 2px 0; line-height: 1.45; }

/* «Ещё» */
.more-empty { text-align: center; padding: 70px 24px; color: var(--muted); }
.more-empty .me-ic { width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 18px;
  background: var(--bg-soft); border: 1px solid var(--border); display: grid; place-items: center; }
.more-empty h3 { margin: 0 0 6px; color: var(--strong); font-size: 17px; }
.more-empty p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.more-soon { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.more-soon .pl-chip { padding: 7px 12px; font-size: 12.5px; }

/* нижний лист добавления/редактирования места */
.pl-sheet-back { position: fixed; inset: 0; z-index: 1000; background: rgba(15,20,35,.45);
  display: none; align-items: flex-end; justify-content: center; }
.pl-sheet-back.on { display: flex; }
.pl-sheet { background: var(--bg); width: 100%; max-width: 720px; max-height: 88vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 40px rgba(15,20,40,.3); }
.pl-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.pl-sheet-head h3 { margin: 0; font-size: 18px; color: var(--strong); }
.pl-field { margin-bottom: 14px; }
.pl-field > label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.pl-cats { display: flex; flex-wrap: wrap; gap: 7px; }
.pl-cat { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-soft); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; }
.pl-cat.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.pl-locrow { display: flex; gap: 7px; flex-wrap: wrap; }
.pl-locbtn2 { flex: 1; min-width: 120px; padding: 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-soft); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.pl-locbtn2:active { background: var(--surface-2); }
.pl-locstate { font-size: 12.5px; color: var(--muted); margin-top: 8px; min-height: 16px; }
.pl-locstate.set { color: var(--buy); font-weight: 600; }
.pl-save { width: 100%; background: var(--accent); color: var(--on-accent); border: 0; border-radius: 12px;
  font: inherit; font-size: 16px; font-weight: 700; padding: 13px; cursor: pointer; margin-top: 4px; }
.pl-save:active { filter: brightness(.94); }
.pl-save[disabled] { opacity: .5; cursor: default; }

/* тост (fallback, если уведомления недоступны) */
.pl-toast { position: fixed; left: 50%; bottom: calc(74px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px); z-index: 1100; opacity: 0; pointer-events: none;
  background: var(--strong); color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 11px 16px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.35); max-width: 84vw;
  transition: opacity .2s, transform .2s; }
.pl-toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* карточка места (детали) */
.pl-detail { padding-top: 14px; }
.pl-photo { margin: -2px 0 14px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.pl-photo img { display: block; width: 100%; max-height: 220px; object-fit: cover; }
.pl-gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: -2px -2px 14px; padding: 0 2px 6px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.pl-gallery::-webkit-scrollbar { display: none; }
.pl-slide { flex: 0 0 100%; scroll-snap-align: center; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.pl-slide img { display: block; width: 100%; height: 220px; object-fit: cover; }
.pl-d-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pl-d-head .pl-emoji { width: 46px; height: 46px; font-size: 22px; }
.pl-d-h-mid { flex: 1; min-width: 0; }
.pl-d-name { font-weight: 800; font-size: 18px; color: var(--strong); }
.pl-d-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 14px; }
.pl-d-row > span { color: var(--muted); flex: 0 0 auto; }
.pl-d-row b { color: var(--strong); font-weight: 600; text-align: right; }
.pl-d-desc { margin-top: 12px; font-size: 13.5px; line-height: 1.5; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; }
/* личная заметка */
.pl-textarea { width: 100%; resize: vertical; min-height: 44px; font: inherit; line-height: 1.4; padding: 9px 11px; }
.pl-usernote { margin-top: 3px; font-size: 12.5px; line-height: 1.35; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pl-d-note { margin-top: 12px; font-size: 14px; line-height: 1.45; color: var(--strong); background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; }
.pl-d-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pl-d-btns .pl-btn { flex: 1 0 100%; height: 46px; }
.pl-d-btns .pl-locbtn2 { flex: 1; }
.pl-d-del { color: var(--sell); }

/* ═══ ТЕРМИНАЛ-ЛЮКС · Заведения (рескин 18.07) ═══ */
.pl-top { background: rgba(10,12,16,.9); backdrop-filter: saturate(1.2) blur(12px); -webkit-backdrop-filter: saturate(1.2) blur(12px); }
.pl-top .pl-logo { background: var(--surface-2); box-shadow: 0 0 0 1px var(--border-strong); }
.pl-fab { color: var(--on-accent); box-shadow: 0 8px 22px -4px rgba(220,201,160,.45); }
.pl-btn { color: var(--on-accent); }
.pl-star { color: #566070; }
.pl-star.on { color: var(--accent); }
.pl-toast { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.themebar { background: rgba(10,12,16,.9); backdrop-filter: saturate(1.2) blur(14px); -webkit-backdrop-filter: saturate(1.2) blur(14px); border-top: 1px solid var(--border); }
.themebar .tbtn.on { color: var(--accent); }
.themebar { box-shadow: 0 -6px 20px rgba(0,0,0,.4); }
.pl-dist b { color: var(--accent); }
/* отступ снизу под фиксированный бар тем */
.pl-body { padding-bottom: 96px; }
#theme-more { padding-bottom: 96px; }

/* leaflet: убрать фокус-рамку, поджать атрибуцию */
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 9px; }
