/* Atlas Map — стили веб-карты: тема (светлая/тёмная), десктоп-панель 400 px и мобильная шторка,
   поиск, карточки, маршруты, контролы карты, тосты, модальные окна. Системный шрифт, без внешних ресурсов. */

:root {
  --blue: #2D6CDF; --blue-dark: #1B4FB3; --orange: #FF7A1A; --green: #15803D; --red: #DC2626; --amber: #B45309;
  --bg: #F6F7FB; --panel: #FFFFFF; --panel-2: #F6F7FB; --text: #0F172A; --muted: #64748B; --border: #E5E7EB;
  --hover: #F1F5F9; --input-bg: #F1F5F9; --shadow: 0 8px 30px rgba(15, 23, 42, .14); --shadow-sm: 0 2px 10px rgba(15, 23, 42, .12);
  --radius: 16px; --radius-sm: 12px; --panel-w: 400px; --top-h: 150px; --peek: 140px;
  --badge-open-bg: #DCFCE7; --badge-closed-bg: #FEE2E2; --toast-bg: #0F172A; --toast-text: #fff;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0B1220; --panel: #111A2E; --panel-2: #0F172A; --text: #E5E9F2; --muted: #94A3B8; --border: #253250;
  --hover: #1A2540; --input-bg: #1A2540; --shadow: 0 8px 30px rgba(0, 0, 0, .55); --shadow-sm: 0 2px 10px rgba(0, 0, 0, .45);
  --badge-open-bg: rgba(22, 163, 74, .2); --badge-closed-bg: rgba(220, 38, 38, .2); --toast-bg: #E5E9F2; --toast-text: #0F172A;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; line-height: 1.4; color: var(--text); background: var(--bg);
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; opacity: .5; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin: 0; }
img { display: block; max-width: 100%; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pad { padding: 8px 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.emoji { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.ico { display: inline-flex; width: 1.25em; height: 1.25em; vertical-align: -0.25em; flex: none; }
.ico svg { width: 100%; height: 100%; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; font-size: 18px; }

#app { position: fixed; inset: 0; overflow: hidden; }
#map { position: absolute; inset: 0; background: var(--bg); }
#map.night .maplibregl-canvas { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.95); }
#map.picking .maplibregl-canvas { cursor: crosshair; }
.maplibregl-ctrl-attrib { font-size: 11px; background: rgba(255, 255, 255, .75) !important; border-radius: 8px 0 0 0; color: #333; }
.maplibregl-ctrl-attrib a { color: #333; }
html[data-theme="dark"] .maplibregl-ctrl-attrib { background: rgba(17, 26, 46, .8) !important; color: #cbd5e1; }
html[data-theme="dark"] .maplibregl-ctrl-attrib a { color: #cbd5e1; }
.maplibregl-ctrl-scale { background: rgba(255, 255, 255, .7); border-color: #333; color: #333; font-size: 11px; border-radius: 0 0 6px 6px; }
html[data-theme="dark"] .maplibregl-ctrl-scale { background: rgba(17, 26, 46, .7); color: #cbd5e1; border-color: #cbd5e1; }
.maplibregl-ctrl-bottom-left { left: calc(var(--panel-w) + 24px); }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl { margin: 0 12px 10px 0; }

/* ---------- кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 600; font-size: 14px; border: 1px solid transparent; white-space: nowrap; transition: background .15s, box-shadow .15s; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.ghost { background: var(--input-bg); color: var(--text); }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger-text { color: var(--red); }
.btn.link { background: none; color: var(--blue); height: auto; padding: 0; font-weight: 500; }
.btn.small { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; color: var(--muted); flex: none; transition: background .15s, color .15s; }
.iconbtn:hover { background: var(--hover); color: var(--text); }
.iconbtn .ico { width: 22px; height: 22px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 17px; background: var(--panel); border: 1px solid var(--border); color: var(--text); font-size: 13.5px; font-weight: 500; white-space: nowrap; flex: none; transition: background .15s, border-color .15s; }
.chip:hover { background: var(--hover); }
.chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip.small { height: 26px; padding: 0 10px; font-size: 12.5px; background: var(--input-bg); border-color: transparent; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.badge.open { background: var(--badge-open-bg); color: var(--green); }
.badge.closed { background: var(--badge-closed-bg); color: var(--red); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--input-bg); font-size: 12px; color: var(--muted); margin: 0 6px 6px 0; }
.tags { padding: 4px 16px; }

/* ---------- панель (десктоп) ---------- */
.panel {
  position: absolute; top: 12px; left: 12px; bottom: 12px; width: var(--panel-w); z-index: 5;
  display: flex; flex-direction: column; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.panel-top { padding: 12px 12px 0; flex: none; position: relative; z-index: 2; background: var(--panel); }
.brand-row { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-img { height: 28px; width: auto; }
.brand-img.dark, html[data-theme="dark"] .brand-img.light { display: none; }
html[data-theme="dark"] .brand-img.dark { display: block; }
.brand-text { display: none; }
.brand.no-logo .brand-img { display: none; }
.brand.no-logo .brand-text { display: inline; }
.brand.no-logo .brand-text::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--blue); margin-right: 8px; vertical-align: -1px; }

.searchbar { display: flex; align-items: center; gap: 2px; height: 48px; padding: 0 4px 0 6px; background: var(--input-bg); border-radius: var(--radius-sm); }
.searchbar:focus-within { box-shadow: 0 0 0 2px var(--blue) inset; }
.search-ico { width: 36px; pointer-events: none; }
.search-input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; font-size: 15px; outline: none; padding: 0 4px; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-input::placeholder { color: var(--muted); }
.search-route { color: var(--blue); }
.chips { display: flex; gap: 8px; padding: 10px 0 10px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
.chips::-webkit-scrollbar { display: none; }

.suggest-wrap { position: absolute; left: 0; right: 0; top: var(--top-h); bottom: 0; background: var(--panel); z-index: 3; overflow-y: auto; display: none; }
.suggest-wrap.active { display: block; }
.suggest-list { list-style: none; margin: 0; padding: 4px 0 8px; }
.suggest-list.loading { opacity: .7; }
.suggest-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; min-height: 48px; }
.suggest-item:hover, .suggest-item.active { background: var(--hover); }
.suggest-ico { width: 20px; height: 20px; color: var(--muted); flex: none; }
.suggest-ico.es { color: var(--blue); }
.suggest-body { flex: 1; min-width: 0; }
.suggest-title { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-title b { color: var(--blue); font-weight: 700; }
.suggest-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-dist { font-size: 12px; color: var(--muted); flex: none; }
.suggest-empty { padding: 14px 16px; color: var(--muted); display: flex; gap: 8px; align-items: center; }

.sheet { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.sheet-handle { display: none; }
.panel-content { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding-bottom: 16px; }

.view-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: var(--panel); border-bottom: 1px solid var(--border); }
.view-title { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view-body { padding-top: 4px; }

/* ---------- главный экран ---------- */
.home-head { padding: 12px 16px 8px; }
.home-head h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px 16px 12px; }
.quick-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 72px; border-radius: var(--radius-sm); background: var(--input-bg); color: var(--text); font-size: 11.5px; font-weight: 600; text-align: center; line-height: 1.15; padding: 4px; transition: background .15s; }
.quick-tile:hover { background: var(--hover); }
.quick-tile .ico { width: 22px; height: 22px; color: var(--blue); }
.home-section { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 4px; }
.home-section h3 { font-size: 14px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.section-title { font-size: 14px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 14px 16px 6px; }
.notice { display: flex; gap: 10px; align-items: flex-start; margin: 10px 16px; padding: 10px 12px; border-radius: 10px; background: var(--input-bg); color: var(--muted); font-size: 13px; }
.notice .ico { color: var(--blue); margin-top: 1px; }

/* ---------- списки ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 56px; cursor: pointer; border-bottom: 1px solid var(--border); position: relative; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover, .list-item:focus-visible { background: var(--hover); outline: none; }
.list-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--input-bg); color: var(--muted); flex: none; font-size: 18px; }
.list-ico svg { width: 20px; height: 20px; }
.list-ico.es { background: rgba(45, 108, 223, .12); color: var(--blue); }
.list-body { flex: 1; min-width: 0; }
.list-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.list-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-dist { font-size: 12.5px; color: var(--muted); flex: none; }
.list-remove { width: 32px; height: 32px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px; }

/* результаты */
.results-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px 4px; min-height: 36px; }
.result .num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--orange); color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.result-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.result-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.result-route { width: 34px; height: 34px; color: var(--blue); }
.stars { display: inline-flex; gap: 1px; color: #D1D5DB; }
.stars .ico { width: 16px; height: 16px; }
.stars.sm .ico { width: 13px; height: 13px; }
.stars .ico.on { color: #F59E0B; }

/* ---------- карточка ---------- */
.gallery { display: flex; gap: 8px; padding: 8px 16px; overflow-x: auto; scrollbar-width: thin; }
.gallery-item { flex: none; width: 150px; height: 104px; border-radius: 10px; overflow: hidden; background: var(--input-bg); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.card-head { padding: 10px 16px 6px; }
.card-title { font-size: 21px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; }
.card-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; font-size: 13px; }
.card-rating { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 8px; padding: 8px 16px 12px; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; height: 66px; border-radius: var(--radius-sm); background: var(--input-bg); color: var(--text); font-size: 11.5px; font-weight: 600; transition: background .15s; padding: 0 4px; }
.act:hover { background: var(--hover); }
.act .ico { width: 22px; height: 22px; color: var(--blue); }
.act.primary { background: var(--blue); color: #fff; }
.act.primary .ico { color: #fff; }
.act.primary:hover { background: var(--blue-dark); }
.act.on .ico { color: var(--red); }
.act-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.info-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 16px; color: var(--text); border-top: 1px solid var(--border); }
.info-row.link:hover { background: var(--hover); text-decoration: none; }
.info-ico { width: 20px; height: 20px; color: var(--muted); margin-top: 2px; }
.info-body { flex: 1; min-width: 0; }
.info-title { font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere; }
.info-sub { font-size: 12.5px; color: var(--muted); }
.info-row .chev { width: 18px; height: 18px; color: var(--muted); margin-top: 4px; transition: transform .2s; }
.info-row.hours { cursor: pointer; }
.hours-list { display: none; margin-top: 8px; }
.info-row.hours.expanded .hours-list { display: block; }
.info-row.hours.expanded .chev { transform: rotate(180deg); }
.hours-day { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 13.5px; color: var(--muted); }
.hours-day.today { color: var(--text); font-weight: 600; }
.card-section { padding: 12px 16px; border-top: 1px solid var(--border); }
.card-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.card-section h3 .muted { font-weight: 500; }
.desc { font-size: 14px; line-height: 1.5; white-space: pre-line; }
.review { padding: 10px 0; border-top: 1px solid var(--border); }
.review:first-of-type { border-top: 0; }
.review-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; flex-wrap: wrap; }
.review p { font-size: 14px; line-height: 1.5; }
.review-form { margin-top: 10px; }
.star-picker { display: flex; gap: 4px; margin: 4px 0 8px; }
.star-btn { width: 36px; height: 36px; color: #D1D5DB; border-radius: 8px; display: grid; place-items: center; }
.star-btn .ico { width: 26px; height: 26px; }
.star-btn.on { color: #F59E0B; }
.star-btn:hover { background: var(--hover); }

/* ---------- формы ---------- */
.form { padding: 4px 16px 16px; }
.label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 5px; font-weight: 600; }
.label i { color: var(--red); font-style: normal; margin-left: 2px; }
.input { display: block; width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--input-bg); outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(45, 108, 223, .2); }
textarea.input { resize: vertical; line-height: 1.4; }
select.input { appearance: auto; }
.input.time { width: auto; min-width: 0; padding: 6px 8px; min-height: 36px; }
.form-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.form-error { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 8px; }
.form-hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 8px; }
.form-hint.ok { color: var(--green); }
.form-hint.err { color: var(--red); }
.radio-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.radio, .check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; min-height: 32px; }
.radio input, .check input { width: 18px; height: 18px; accent-color: var(--blue); margin: 0; }
.confirm-text { font-size: 15px; line-height: 1.5; }
.hours-editor { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.hours-grid { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.hours-row { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.hours-row .day { width: 24px; font-weight: 600; color: var(--muted); flex: none; }
.hours-row.off .input { opacity: .35; pointer-events: none; }
.hours-row .check { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.hours-editor.allday .hours-grid { opacity: .35; pointer-events: none; }
.seg { display: inline-flex; background: var(--input-bg); border-radius: 10px; padding: 3px; gap: 2px; max-width: 100%; }
.seg-btn { height: 34px; padding: 0 14px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.seg-btn.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }
.settings-row { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: 0; }
.settings-row h3 { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.settings-row h4 { font-size: 13px; font-weight: 700; margin: 12px 0 4px; }
.settings-row .input { margin-bottom: 4px; }
.settings-row .row { margin-top: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* офлайн */
.pack { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.pack:last-child { border-bottom: 0; }
.pack-body { flex: 1; min-width: 0; }
.progress { height: 6px; border-radius: 3px; background: var(--input-bg); margin: 8px 0 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--blue); border-radius: 3px; transition: width .2s; }

/* ---------- маршрут ---------- */
.profiles { display: flex; gap: 6px; padding: 8px 16px 4px; }
.profile { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 40px; border-radius: 10px; background: var(--input-bg); color: var(--muted); font-weight: 600; font-size: 13px; }
.profile .ico { width: 20px; height: 20px; }
.profile.active { background: var(--blue); color: #fff; }
.route-points { display: flex; flex-direction: column; gap: 8px; padding: 8px 16px 0; }
.route-point { display: flex; align-items: center; gap: 8px; }
.letter { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #8B93A7; color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.letter.start { background: var(--green); }
.letter.end { background: var(--red); }
.route-input { flex: 1; min-width: 0; position: relative; }
.route-input .input { min-height: 42px; padding-right: 10px; }
.dropdown { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); z-index: 20; display: none; max-height: 280px; overflow-y: auto; border: 1px solid var(--border); }
.dropdown.open { display: block; }
.dropdown .suggest-item { padding: 8px 12px; min-height: 42px; }
.route-tools { display: flex; gap: 8px; padding: 10px 16px; flex-wrap: wrap; }
.route-results { border-top: 1px solid var(--border); }
.alts { display: flex; gap: 8px; padding: 12px 16px 4px; overflow-x: auto; scrollbar-width: none; }
.alts::-webkit-scrollbar { display: none; }
.alt { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 110px; padding: 8px 12px; border-radius: 10px; border: 2px solid var(--border); background: var(--panel); color: var(--text); text-align: left; }
.alt b { font-size: 15px; }
.alt span { font-size: 12.5px; color: var(--muted); }
.alt small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.alt.active { border-color: var(--blue); background: rgba(45, 108, 223, .08); }
.route-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; }
.route-summary-main b { font-size: 20px; }
.steps { display: flex; flex-direction: column; padding: 4px 0 8px; }
.steps-leg { padding: 10px 16px 4px; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.step { display: flex; align-items: flex-start; gap: 12px; padding: 9px 16px; text-align: left; color: var(--text); border-left: 3px solid transparent; }
.step:hover { background: var(--hover); }
.step.active { border-left-color: var(--orange); background: var(--hover); }
.step-ico { width: 26px; height: 26px; color: var(--blue); flex: none; margin-top: 1px; }
.step-body { flex: 1; min-width: 0; }
.step-text { font-size: 14px; line-height: 1.35; }
.step-dist { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- маркеры ---------- */
.sel-marker svg { filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .3)); }
.route-marker { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #8B93A7; border: 3px solid #fff; color: #fff; font-weight: 800; font-size: 13px; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); cursor: grab; }
.route-marker.start { background: var(--green); }
.route-marker.end { background: var(--red); }
.ruler-label { background: #fff; color: #0F172A; padding: 3px 8px; border-radius: 8px; font-size: 12.5px; font-weight: 700; box-shadow: var(--shadow-sm); white-space: nowrap; }
.ruler-panel { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; }
.ruler-panel .ico { color: var(--orange); }
.ruler-panel .iconbtn { width: 36px; height: 36px; }

/* ---------- контролы карты ---------- */
.map-controls { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); z-index: 4; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.mapbtn { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 12px; background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); transition: background .15s, color .15s; }
.mapbtn:hover { background: var(--hover); }
.mapbtn .ico { width: 22px; height: 22px; }
.mapbtn.active { color: var(--blue); box-shadow: 0 0 0 2px var(--blue) inset, var(--shadow-sm); }
.mapbtn.compass { display: none; }
.mapbtn.compass.visible { display: flex; }
.mapbtn.compass .ico { color: var(--red); transition: transform .2s; }
.mapbtn.locate.busy .ico { animation: pulse 1s infinite; }
.mapbtn-group { display: flex; flex-direction: column; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow-sm); overflow: hidden; }
.mapbtn-group .mapbtn { box-shadow: none; border-radius: 0; }
.mapbtn-group .mapbtn + .mapbtn { border-top: 1px solid var(--border); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ---------- тосты / баннер / меню ---------- */
.toasts { position: absolute; left: calc(var(--panel-w) + 24px); right: 24px; bottom: 28px; z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; max-width: min(520px, 100%); padding: 10px 14px; border-radius: 12px; background: var(--toast-bg); color: var(--toast-text); box-shadow: var(--shadow); font-size: 14px; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: auto; }
.toast.show { opacity: 1; transform: none; }
.toast.success .ico { color: #4ADE80; }
.toast.error .ico { color: #FCA5A5; }
.toast.info .ico { color: #93C5FD; }
.toast-action { color: #93C5FD; font-weight: 700; margin-left: 6px; }
.offline-banner { position: absolute; top: 12px; left: 50%; transform: translate(-50%, -140%); z-index: 40; display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; background: #FEF3C7; color: #78350F; font-weight: 600; box-shadow: var(--shadow-sm); transition: transform .25s, opacity .25s, visibility .25s; white-space: nowrap; max-width: calc(100% - 24px); visibility: hidden; opacity: 0; }
.offline-banner.show { transform: translate(-50%, 0); visibility: visible; opacity: 1; }
.ctx-menu, .popover { position: fixed; z-index: 60; min-width: 230px; padding: 6px; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.ctx-menu { display: none; }
.ctx-menu.open { display: block; }
.ctx-title, .popover-title { padding: 6px 10px 8px; font-size: 12px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.ctx-item, .popover-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 42px; padding: 0 10px; border-radius: 8px; color: var(--text); text-align: left; font-size: 14px; }
.ctx-item:hover, .popover-item:hover { background: var(--hover); }
.ctx-item .ico, .popover-item .ico { width: 20px; height: 20px; color: var(--muted); }
.popover-item.active { color: var(--blue); font-weight: 600; }
.popover-item.active .ico { color: var(--blue); }
.popover-item span { flex: 1; }
.popover-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ---------- модальные окна ---------- */
.modal { position: fixed; inset: 0; z-index: 70; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); }
.modal.open { display: flex; }
.modal-dialog { width: 100%; max-width: 460px; max-height: calc(100% - 16px); overflow-y: auto; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); }
.modal-dialog.wide { max-width: 960px; background: transparent; box-shadow: none; overflow: visible; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 12px 0 20px; }
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 8px 20px 16px; }
.modal-dialog.wide .modal-body { padding: 0; }
.modal-body .form { padding: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 16px; }
.lightbox { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lightbox-img { max-height: 78vh; max-width: 100%; border-radius: 12px; object-fit: contain; background: #000; }
.lightbox-bar { display: flex; align-items: center; gap: 12px; color: #fff; font-weight: 600; }
.lightbox-bar .iconbtn { color: #fff; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .9); color: #0F172A; display: grid; place-items: center; }
.lightbox-nav.prev { left: 8px; }
.lightbox-nav.next { right: 8px; }

/* ---------- состояния ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 36px 24px; gap: 8px; }
.empty-ico { width: 52px; height: 52px; color: var(--muted); opacity: .6; }
.empty-ico svg { width: 100%; height: 100%; }
.empty-title { font-size: 16px; font-weight: 700; }
.empty-hint { font-size: 13.5px; color: var(--muted); max-width: 300px; }
.empty-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }
.skeleton { padding: 8px 16px; }
.sk-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; }
.sk-ico { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sk-line { height: 12px; border-radius: 6px; width: 80%; }
.sk-line.short { width: 50%; }
.sk-ico, .sk-line { background: linear-gradient(90deg, var(--input-bg) 25%, var(--hover) 50%, var(--input-bg) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.loading { display: flex; align-items: center; gap: 12px; padding: 20px 16px; color: var(--muted); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--blue); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- мобильный макет ---------- */
@media (max-width: 899px) {
  .panel { position: static; width: auto; background: none; box-shadow: none; border-radius: 0; overflow: visible; pointer-events: none; display: block; }
  .panel-top { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); left: 8px; right: 8px; padding: 0; background: none; z-index: 8; pointer-events: auto; }
  .brand-row { display: none; }
  .searchbar { height: 50px; background: var(--panel); box-shadow: var(--shadow-sm); }
  .search-input { font-size: 16px; }
  .iconbtn { width: 44px; height: 44px; }
  .chips { margin: 0 -8px; padding: 8px 8px 0; }
  .chip { height: 36px; box-shadow: var(--shadow-sm); }
  .suggest-wrap { position: fixed; top: var(--top-h); left: 0; right: 0; bottom: 0; z-index: 7; pointer-events: auto; padding-top: 4px; }
  .panel.suggesting .chips { display: none; }
  .sheet {
    position: fixed; left: 0; right: 0; bottom: 0; height: calc(100dvh - var(--top-h) - 8px); z-index: 6; pointer-events: auto;
    background: var(--panel); border-radius: 18px 18px 0 0; box-shadow: 0 -6px 30px rgba(15, 23, 42, .18);
    transform: translateY(50%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); touch-action: none; will-change: transform;
  }
  .sheet.dragging { transition: none; }
  .sheet-handle { display: flex; align-items: center; justify-content: center; height: 22px; flex: none; cursor: grab; }
  .sheet-handle span { width: 42px; height: 5px; border-radius: 3px; background: var(--border); }
  .panel-content { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); touch-action: pan-y; }
  .sheet[data-state="collapsed"] .panel-content { overflow: hidden; }
  .sheet[data-state="collapsed"] .home-head p { display: none; }
  .view-header { padding: 0 8px 6px; }
  .view-back { display: none; }
  .panel[data-sheet] .view-header .view-back { display: inline-flex; }
  .home-head { padding: 4px 16px 10px; }
  .home-head h2 { font-size: 17px; }
  .home-head p { font-size: 13px; }
  .map-controls { right: 10px; top: calc(var(--top-h) + 14px); transform: none; gap: 8px; }
  .mapbtn { width: 44px; height: 44px; }
  .maplibregl-ctrl-bottom-left { left: 0; }
  .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: calc(var(--peek) + env(safe-area-inset-bottom, 0px)); }
  .maplibregl-ctrl-bottom-right .maplibregl-ctrl { margin: 0 8px 4px 0; }
  .maplibregl-ctrl-attrib.maplibregl-compact { border-radius: 12px; background: rgba(255, 255, 255, .85) !important; }
  html[data-theme="dark"] .maplibregl-ctrl-attrib.maplibregl-compact { background: rgba(17, 26, 46, .85) !important; }
  .maplibregl-ctrl-attrib.maplibregl-compact-show { padding-right: 32px; }
  .toasts { left: 12px; right: 12px; top: calc(var(--top-h) + 10px); bottom: auto; }
  .toast { transform: translateY(-8px); }
  .offline-banner { top: calc(var(--top-h) + 8px); }
  .ruler-panel { bottom: auto; top: calc(var(--top-h) + 10px); max-width: calc(100% - 24px); }
  .ruler-panel .ruler-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .quick { grid-template-columns: repeat(4, 1fr); }
  .act { height: 62px; }
  .modal { padding: 12px; align-items: flex-end; }
  .modal-dialog { max-height: 92dvh; border-radius: 18px; }
  .modal-dialog.wide { align-self: center; }
  .lightbox-img { max-height: 70vh; }
  .alt { min-width: 100px; }
  .input, select.input { min-height: 46px; font-size: 16px; }
  .btn { min-height: 44px; }
  .btn.small { min-height: 36px; }
}
@media (max-width: 420px) {
  .quick-tile { font-size: 11px; }
  .act-label { font-size: 11px; }
  .profile > span:not(.ico) { display: none; }
  .profile .ico { width: 24px; height: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
