/* ── Переменные ── */
:root {
  --g: #16a34a; --y: #d97706; --r: #dc2626; --b: #2563eb; --p: #7c3aed;
  --bg: #f3f4f6; --panel: #ffffff; --panel2: #f9fafb;
  --ink: #111827; --muted: #6b7280; --line: #e5e7eb;
  --head-bg: rgba(255,255,255,.92);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.1);
  --shadow: 0 4px 20px rgba(0,0,0,.13), 0 1px 4px rgba(0,0,0,.07);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.18);
  --radius: 14px; --radius-sm: 8px;
  --header-h: 58px;
  --search-w: 300px;
  --card-w: 320px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}
body.dark {
  --g: #22c55e; --y: #fbbf24; --r: #f87171; --b: #60a5fa; --p: #a78bfa;
  --bg: #0f1117; --panel: #1a1d27; --panel2: #20242f;
  --ink: #f1f5f9; --muted: #94a3b8; --line: #2d3348;
  --head-bg: rgba(26,29,39,.94);
  --shadow: 0 4px 20px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100vh; height: 100dvh; width: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px; color: var(--ink); background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  overscroll-behavior: none;
}
.mono { font-family: 'PT Mono', 'Menlo', 'Consolas', monospace; }
.hidden { display: none !important; }

/* ── Карта ── */
#map {
  position: fixed; inset: 0; z-index: 0;
  background: var(--bg);
}
.leaflet-control-zoom { display: none; }
.leaflet-control-attribution {
  font-size: 9px; line-height: 1.3;
  background: rgba(0,0,0,.25); color: rgba(255,255,255,.55);
  padding: 1px 5px; border-radius: 4px 0 0 0;
  opacity: .55; transition: opacity .15s;
}
.leaflet-control-attribution a { color: inherit; }
.leaflet-control-attribution:hover { opacity: 1; }

/* ── Шапка ── */
.ui-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1100;
  height: calc(var(--header-h) + var(--safe-top));
  background: var(--head-bg);
  backdrop-filter: blur(14px) saturate(1.6);
  -webkit-backdrop-filter: blur(14px) saturate(1.6);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
  padding: var(--safe-top) calc(14px + var(--safe-right)) 0 calc(14px + var(--safe-left));
}
.ui-brand {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; color: inherit; flex-shrink: 0;
}
.ui-brand-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  object-fit: contain;
}
.ui-brand-title {
  font-size: 14px; font-weight: 700; line-height: 1.1; white-space: nowrap;
}
.ui-brand-sub {
  font-size: 10px; color: var(--muted); margin-top: 1px;
  font-family: 'PT Mono', monospace; letter-spacing: .04em;
  text-transform: uppercase; white-space: nowrap;
}
.ui-header-center {
  flex: 1; display: flex; align-items: center; gap: 5px;
  overflow-x: auto; scrollbar-width: none; padding: 0 6px;
}
.ui-header-center::-webkit-scrollbar { display: none; }

.ui-header-right {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel2); color: var(--ink); font-size: 14px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.icon-btn:hover { background: var(--line); }
.btn-login {
  height: 34px; padding: 0 16px; border-radius: 9px;
  border: none; background: var(--g); color: #fff;
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: opacity .15s;
}
.btn-login:hover { opacity: .88; }
.user-area { display: flex; align-items: center; gap: 6px; }
.user-name {
  font-size: 12px; color: var(--muted);
  font-family: 'PT Mono', monospace;
  white-space: nowrap; max-width: 120px;
  overflow: hidden; text-overflow: ellipsis;
}

/* ── Чипы-легенда ── */
.legend-chip {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 9px 3px 6px; border-radius: 20px;
  background: var(--panel2); border: 1px solid var(--line);
  font-size: 11px; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: opacity .15s, background .15s;
  user-select: none; flex-shrink: 0;
}
.legend-chip .chip-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.legend-chip .chip-num { font-family: 'PT Mono', monospace; font-size: 12px; }
.legend-chip.off { opacity: .4; }
.legend-chip:hover { background: var(--line); }
.legend-chip.legend-all {
  background: var(--g); border-color: var(--g); color: #fff;
}
.legend-chip.legend-all:hover { opacity: .88; background: var(--g); }
.legend-chip.legend-all:not(.on) { opacity: .55; background: var(--panel2); border-color: var(--line); color: var(--ink); }

/* ── Поиск ── */
.left-col {
  position: fixed; top: calc(var(--header-h) + var(--safe-top) + 10px); left: calc(12px + var(--safe-left));
  width: var(--search-w); z-index: 1000;
  display: flex; flex-direction: column; gap: 10px;
  height: calc(100vh - var(--header-h) - var(--safe-top) - var(--safe-bottom) - 22px);
  height: calc(100dvh - var(--header-h) - var(--safe-top) - var(--safe-bottom) - 22px);
  overflow-y: auto; overflow-x: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  pointer-events: none;
}
.left-col::-webkit-scrollbar { display: none; }
.left-col > * { pointer-events: auto; flex-shrink: 0; }
.left-col > .ui-search { flex-shrink: 1; }

.ui-search {
  width: 100%;
  flex: 1 1 auto; min-height: 0;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.search-input-wrap {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.search-icon { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
#q {
  flex: 1; font: inherit; font-size: 13px;
  border: none; outline: none; background: transparent; color: var(--ink);
}
#q::placeholder { color: var(--muted); }
.search-clear {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 13px; padding: 2px 4px; line-height: 1;
}
.station-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.station-list:empty::after {
  content: 'Нет результатов';
  display: block; padding: 16px; text-align: center;
  color: var(--muted); font-size: 12px;
}

/* ── Инфо-блок главы округа ── */
.ui-info {
  width: 100%; background: var(--panel);
  border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 14px 16px 16px;
  display: flex; flex-direction: column; gap: 10px;
  font-size: 12px; line-height: 1.5; color: var(--ink);
}
.info-head { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.info-photo {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover;
  flex-shrink: 0; border: 2px solid var(--line);
}
.info-head-text { flex: 1; min-width: 0; }
.info-name { font-size: 12.5px; font-weight: 700; }
.info-role { font-size: 10.5px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.info-chevron {
  flex-shrink: 0; color: var(--muted); font-size: 12px;
  transition: transform .2s;
}
.ui-info.collapsed .info-chevron { transform: rotate(-90deg); }
.ui-info.collapsed .info-body { display: none; }
.info-body { display: flex; flex-direction: column; gap: 10px; }
.info-contacts {
  font-size: 11px; color: var(--muted);
  display: flex; flex-direction: column; gap: 2px;
}
.info-contacts a { color: inherit; }
.info-message p { margin-bottom: 8px; }
.info-message p:last-child { margin-bottom: 0; }
.info-dev {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 10.5px; color: var(--muted);
}
.dev-links { display: flex; align-items: center; gap: 16px; }
.dev-link {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--muted); text-decoration: none;
}
.dev-link:hover { color: var(--ink); }
.dev-link svg { width: 13px; height: 13px; flex-shrink: 0; }
.dev-link .max-logo { width: 13px; height: 13px; flex-shrink: 0; }
body.dark .dev-link .max-logo { filter: invert(1); }

/* строка списка */
.srow {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px; cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background .12s;
}
.srow:last-child { border-bottom: none; }
.srow:hover { background: var(--panel2); }
.srow.active { background: var(--panel2); }
.pin-wrap { position: relative; flex-shrink: 0; }
.srow-pin {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; letter-spacing: -.3px;
  border: 2.5px solid transparent;
  overflow: hidden;
}
.srow-info { flex: 1; min-width: 0; }
.srow-name {
  font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.srow-addr {
  font-size: 11px; color: var(--muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.srow-stale { font-size: 10px; color: var(--y); }

/* ── Карточка АЗС ── */
.station-card {
  position: fixed; top: calc(var(--header-h) + var(--safe-top)); right: 0; bottom: 0;
  width: var(--card-w); z-index: 1050;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: var(--safe-right);
  animation: slideIn .2s ease;
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.card-header {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 10px 12px 0;
  position: sticky; top: 0; background: var(--panel); z-index: 2;
}
.card-close {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel2); color: var(--muted);
  font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.card-close:hover { background: var(--line); color: var(--ink); }
.card-body { padding: 4px calc(16px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(16px + var(--safe-left)); }

/* карточка — шапка станции */
.card-brand-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px;
}
.logo-wrap { position: relative; flex-shrink: 0; }
.card-logo {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; letter-spacing: -.3px;
  border: 3px solid transparent;
  overflow: hidden;
}
.card-title { font-size: 15px; font-weight: 700; line-height: 1.2; }
.card-num { font-size: 11px; color: var(--muted); margin-top: 2px; }
.card-addr {
  font-size: 12px; color: var(--muted); margin-bottom: 10px;
  line-height: 1.4;
}
.route-btn {
  display: flex; align-items: center; justify-content: center;
  height: 38px; border-radius: var(--radius-sm);
  background: #f59e0b; color: #1a1200;
  font-size: 13px; font-weight: 700; text-decoration: none;
  margin-bottom: 14px; transition: opacity .15s;
}
.route-btn:hover { opacity: .88; }

/* фото АЗС */
.card-photo-wrap {
  margin-bottom: 10px; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--panel2);
}
.card-photo-wrap:empty { display: none; }
.card-photo { width: 100%; height: 160px; object-fit: cover; display: block; }
.photo-actions { display: flex; gap: 7px; margin-bottom: 14px; }
.photo-upload-label {
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex: 1;
}

/* карточка — топливо */
.card-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 7px;
}
.fuel-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px;
}
.fuel-cell {
  border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  padding: 10px 10px 8px; cursor: pointer;
  transition: border-color .15s, transform .1s;
  position: relative;
}
.fuel-cell:hover { transform: translateY(-1px); }
.fuel-cell.active-available { border-color: var(--g); background: color-mix(in srgb, var(--g) 8%, transparent); }
.fuel-cell.active-unavailable { border-color: var(--r); background: color-mix(in srgb, var(--r) 8%, transparent); }
.fuel-cell.active-unknown { border-color: var(--muted); }
.fuel-cell-type { font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.fuel-cell-status { font-size: 14px; font-weight: 700; }
.fuel-cell-status.s-available { color: var(--g); }
.fuel-cell-status.s-unavailable { color: var(--r); }
.fuel-cell-status.s-unknown { color: var(--muted); }
.fuel-cell-time { font-size: 10px; color: var(--muted); margin-top: 3px; font-family: 'PT Mono', monospace; }
.fuel-cell-time.stale { color: var(--y); }

/* редактирование статуса топлива */
.fuel-edit-btns { display: flex; gap: 4px; margin-top: 6px; }
.fst-btn {
  flex: 1; height: 24px; border-radius: 5px; border: 1.5px solid var(--line);
  background: var(--panel2); font-size: 10px; font-weight: 600; cursor: pointer;
  transition: all .12s; color: var(--muted);
}
.fst-btn:hover { border-color: var(--muted); color: var(--ink); }
.fst-btn.sel-available { border-color: var(--g); background: var(--g); color: #fff; }
.fst-btn.sel-unavailable { border-color: var(--r); background: var(--r); color: #fff; }
.fst-btn.sel-unknown { border-color: var(--muted); background: var(--muted); color: #fff; }

/* флаг станции */
.flag-row { display: flex; gap: 6px; margin-bottom: 14px; }
.flag-btn {
  flex: 1; height: 32px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--panel2);
  font-size: 11px; font-weight: 600; cursor: pointer; color: var(--muted);
  transition: all .12s;
}
.flag-btn:hover { border-color: var(--muted); color: var(--ink); }
.flag-btn.active-normal { border-color: var(--g); color: var(--g); background: color-mix(in srgb, var(--g) 8%, transparent); }
.flag-btn.active-repair { border-color: var(--b); color: var(--b); background: color-mix(in srgb, var(--b) 8%, transparent); }
.flag-btn.active-legal_only { border-color: var(--p); color: var(--p); background: color-mix(in srgb, var(--p) 8%, transparent); }

/* заметка */
.note-area {
  width: 100%; font: inherit; font-size: 12.5px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--panel2);
  color: var(--ink); outline: none; resize: none;
  transition: border-color .15s; margin-bottom: 14px;
}
.note-area:focus { border-color: var(--g); }

/* история */
.history-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; cursor: pointer;
  border-top: 1px solid var(--line); margin-bottom: 0;
  font-size: 12px; font-weight: 600; color: var(--muted);
  user-select: none;
}
.history-toggle:hover { color: var(--ink); }
.history-body { margin-top: 8px; }
.h-row {
  font-size: 11px; color: var(--muted); margin-bottom: 5px; line-height: 1.4;
}
.h-row b { color: var(--ink); }

/* кнопки действий */
.card-actions { display: flex; gap: 7px; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.action-btn {
  flex: 1; height: 32px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel2);
  font: inherit; font-size: 11.5px; color: var(--ink); cursor: pointer;
  transition: all .12s;
}
.action-btn:hover { border-color: var(--muted); }
.action-btn.danger:hover { border-color: var(--r); color: var(--r); }
.action-btn.armed { background: var(--b); color: #fff; border-color: var(--b); }

/* ── Кнопки карты ── */
.map-controls {
  position: fixed; bottom: calc(24px + var(--safe-bottom)); right: calc(14px + var(--safe-right)); z-index: 1000;
}
.map-controls-list {
  display: flex; flex-direction: column; gap: 0;
  background: var(--panel); border-radius: 10px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  overflow: hidden;
}
.mbtn-toggle { display: none; }
.mbtn {
  width: 40px; height: 40px; background: var(--panel); border: none;
  border-bottom: 1px solid var(--line); color: var(--ink);
  font-size: 16px; cursor: pointer; transition: background .12s;
}
.mbtn:last-child { border-bottom: none; }
.mbtn:hover { background: var(--panel2); }
.mbtn.active { background: var(--g); color: #fff; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: calc(24px + var(--safe-bottom)); left: 50%; transform: translateX(-50%);
  z-index: 2000; background: var(--ink); color: var(--panel);
  font-family: 'PT Mono', monospace; font-size: 12px;
  padding: 8px 18px; border-radius: 20px;
  opacity: 0; transition: opacity .25s; pointer-events: none;
  white-space: nowrap; max-width: 320px; text-align: center;
}
.toast.show { opacity: 1; }

/* ── Подсказка добавления ── */
.add-hint {
  position: fixed; top: calc(var(--header-h) + var(--safe-top) + 12px); left: 50%;
  transform: translateX(-50%); z-index: 1200;
  background: var(--b); color: #fff;
  font-family: 'PT Mono', monospace; font-size: 12px;
  padding: 8px 18px; border-radius: 20px; white-space: nowrap;
}

/* ── Маркеры ── */
.bp-wrap {
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.bp {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; letter-spacing: -.3px;
  box-shadow: 0 2px 8px rgba(0,0,0,.35), 0 0 0 1.5px rgba(255,255,255,.5);
  cursor: pointer; transition: transform .15s, box-shadow .15s;
  user-select: none;
  overflow: hidden;
}
.bp-sel {
  transform: scale(1.3);
  box-shadow: 0 4px 16px rgba(0,0,0,.45), 0 0 0 2px rgba(255,255,255,.9);
}
.bp.dim { opacity: .3; }

/* ── Бейдж статуса (галочка/крестик/иконка поверх лого) ── */
.status-badge {
  position: absolute; right: -2px; bottom: -2px; z-index: 2;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; line-height: 1; color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.45);
  pointer-events: none;
}
.pin-wrap .status-badge {
  width: 13px; height: 13px; font-size: 7px; border-width: 1.5px;
  right: -1px; bottom: -1px;
}
.brand-logo {
  width: 88% !important; height: 88% !important; object-fit: contain !important;
  max-width: 88% !important; max-height: 88% !important;
  pointer-events: none;
}
.brand-logo.brand-logo-cover {
  width: 100% !important; height: 100% !important; object-fit: cover !important;
  max-width: 100% !important; max-height: 100% !important;
}

/* ── Модалки ── */
.modal {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: relative; z-index: 1;
  background: var(--panel); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 22px 24px;
  width: 340px; max-width: 100%;
  max-height: 90vh; max-height: 90dvh; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 12px;
}
.modal-wide { width: 440px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h2 { font-size: 17px; }
.modal-sub { font-size: 12px; color: var(--muted); font-family: 'PT Mono', monospace; }
.field-group { display: flex; flex-direction: column; gap: 8px; }
.field-group input, .field-group select {
  font: inherit; font-size: 13.5px; padding: 9px 11px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--panel2); color: var(--ink); outline: none;
}
.field-group input:focus { border-color: var(--g); }
.btn-primary {
  width: 100%; height: 40px; border-radius: var(--radius-sm);
  border: none; background: var(--g); color: #fff;
  font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: opacity .15s; margin-top: 4px;
}
.btn-primary:hover { opacity: .9; }
.form-error { font-size: 12px; color: var(--r); padding: 4px 0; }

/* admin sections */
.admin-section { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.date-row { display: flex; gap: 8px; align-items: center; }
.date-row input {
  flex: 1; font: inherit; font-family: 'PT Mono', monospace; font-size: 13px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel2); color: var(--ink); outline: none;
}
.date-row input:focus { border-color: var(--g); }
.btn-sm {
  height: 32px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel2);
  font: inherit; font-size: 12px; cursor: pointer; color: var(--ink);
  transition: background .12s;
}
.btn-sm:hover { background: var(--line); }

/* пользователи */
.users-list { display: flex; flex-direction: column; gap: 6px; }
.u-row {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.u-info { flex: 1; min-width: 0; }
.u-name { font-size: 12.5px; font-weight: 600; }
.u-login { font-size: 10.5px; color: var(--muted); font-family: 'PT Mono', monospace; }
.u-row select {
  font: inherit; font-size: 11px; padding: 3px 6px;
  border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--ink); outline: none;
}
.u-del {
  font: inherit; font-size: 11px; padding: 4px 8px;
  border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--muted); cursor: pointer;
}
.u-del:hover { border-color: var(--r); color: var(--r); }
.user-form { display: flex; flex-direction: column; gap: 8px; }

/* ── Адаптив ── */
@media (max-width: 700px) {
  /* ширина сужена справа, чтобы не залезать под плавающие кнопки режима карты */
  :root { --search-w: calc(100vw - 84px - var(--safe-left) - var(--safe-right)); --card-w: 100vw; }
  .ui-header-center { display: none; }
  .ui-header-right { margin-left: auto; }
  .user-name { display: none; }
  .station-card {
    top: auto; left: 0; right: 0; bottom: 0;
    width: 100%; max-height: 70vh; max-height: 70dvh;
    border-left: none; border-top: 1px solid var(--line);
    border-radius: var(--radius) var(--radius) 0 0;
    padding-right: 0;
    animation: slideUp .2s ease;
  }
  .card-body {
    padding: 4px calc(16px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(16px + var(--safe-left));
  }
  @keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
  /* блок главы округа — растянут на всю ширину внизу экрана, отдельно от узкой колонки поиска */
  .ui-info {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 990;
    width: auto; border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
    font-size: 11.5px;
    padding: 12px calc(14px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(14px + var(--safe-left));
  }
  .info-photo { width: 44px; height: 44px; }

  /* меню режима карты — перенесено наверх, к строке поиска, как выпадающее меню */
  .map-controls {
    top: calc(var(--header-h) + var(--safe-top) + 10px); bottom: auto;
    right: calc(12px + var(--safe-right));
  }
  .mbtn-toggle {
    display: block;
    border-radius: 10px; border: 1px solid var(--line); box-shadow: var(--shadow);
  }
  .map-controls-list {
    display: none;
    position: absolute; top: calc(100% + 6px); right: 0;
  }
  .map-controls.expanded .map-controls-list { display: flex; }

  /* по умолчанию список свёрнут, чтобы карта была видна сразу; разворачивается по фокусу на поиске.
     Пока свёрнут — карточка поиска не растягивается на всю высоту (иначе выглядит как пустой блок). */
  .station-list { transition: max-height .18s ease; }
  .ui-search.list-collapsed { flex-grow: 0; }
  .ui-search.list-collapsed .station-list { max-height: 0; }

  /* тач-таргеты (мин. 44px по HIG Apple) и запрет авто-зума iOS при фокусе на инпутах (нужен font-size >= 16px) */
  .icon-btn { width: 44px; height: 44px; }
  .card-close { width: 40px; height: 40px; }
  .mbtn { width: 44px; height: 44px; }
  #q, .field-group input, .field-group select, .note-area, .date-row input {
    font-size: 16px;
  }
  .btn-login, .icon-btn, .card-close, .mbtn, .legend-chip, .srow,
  .fst-btn, .flag-btn, .action-btn, .btn-sm, .u-del, .info-head, .history-toggle {
    touch-action: manipulation;
  }
}

@media (max-width: 420px) {
  /* подстраховка на очень узких экранах: не скрываем текст бренда, но не даём ему выталкивать шапку */
  .ui-brand-title, .ui-brand-sub { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
}
