/* style.css — сервис «ГВР на карте». Чистый компактный UI, без внешних библиотек.
   Панель слева отдельной колонкой: карта и её копирайты/лого Яндекса ничем не
   перекрываются (SPEC §8). */

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: #1f2937;
  background: #f8fafc;
}

.hidden {
  display: none !important;
}

/* Временно скрытые инструменты сохранены для последующего включения. */
.workspace-paused {
  display: none !important;
}

#location-message:empty,
#address-message:empty,
#address-results:empty {
  display: none;
}

#location-message.error,
#address-message.error {
  color: #b91c1c;
}

.address-results {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.address-result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  font: inherit;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.address-result:hover,
.address-result[aria-pressed="true"] {
  border-color: #0b6bcb;
  background: #eff6ff;
}

.address-result:focus-visible {
  outline: 2px solid #0b6bcb;
  outline-offset: 2px;
}

.address-result small {
  color: #475569;
  font-size: 12px;
}

/* ------------------------------- Панель слева --------------------------- */

#sidebar {
  width: 380px;
  min-width: 320px;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
}

#mapDetails > summary h1 {
  display: inline;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

#app-header .subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: #6b7280;
}

#sidebar > section {
  flex-shrink: 0;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.account-bar > div:first-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}

.account-role,
.user-status {
  color: #64748b;
  font-size: 11px;
}

.account-actions {
  margin-top: 0;
}

.admin-dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: min(88vh, 800px);
  padding: 18px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  color: #1f2937;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.25);
}

.admin-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.imports-dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: min(88vh, 800px);
  overflow: auto;
  padding: 18px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  color: #1f2937;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.25);
}

.imports-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.imports-section h2,
.imports-dialog h2 {
  margin: 0;
  font-size: 15px;
}

.imports-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.imports-journal,
.imports-result {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.import-run,
.import-item {
  padding: 9px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.import-run-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.import-run time,
.import-muted {
  color: #64748b;
  font-size: 11px;
}

.import-run-summary,
.import-item p {
  margin: 5px 0 0;
}

.imports-form {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.imports-form label {
  font-size: 12px;
  color: #475569;
}

.import-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.import-pagination span {
  margin-right: auto;
  color: #64748b;
  font-size: 12px;
}

.imports-dialog :focus-visible,
.imports-section :focus-visible {
  outline: 2px solid #0b6bcb;
  outline-offset: 2px;
}

.records-section h2,
.records-dialog h2 {
  margin: 0;
  font-size: 15px;
}

.records-search,
.records-detail-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.records-search label,
.records-detail-form label {
  color: #475569;
  font-size: 12px;
}

.records-search input,
.records-search select,
.records-detail-form input,
.records-detail-form textarea,
.records-detail-form select {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #1f2937;
  background: #fff;
  font: inherit;
}

.records-detail-form textarea {
  min-height: 70px;
  resize: vertical;
}

.records-list,
.records-detail {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.records-dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: min(88vh, 900px);
  overflow: auto;
  padding: 18px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  color: #1f2937;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.25);
}

.records-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.records-heading,
.record-version-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.record-version,
.record-event,
.record-summary,
.import-resolve-candidate {
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.record-version.is-current {
  border-color: #60a5fa;
  background: #eff6ff;
}

.record-fields {
  display: grid;
  grid-template-columns: minmax(115px, 0.8fr) minmax(0, 2fr);
  gap: 4px 10px;
  margin: 8px 0;
}

.record-fields dt {
  color: #64748b;
}

.record-fields dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.record-events {
  display: grid;
  gap: 7px;
}

.record-event time,
.record-muted {
  color: #64748b;
  font-size: 11px;
}

.records-dialog :focus-visible,
.records-section :focus-visible {
  outline: 2px solid #0b6bcb;
  outline-offset: 2px;
}

.import-resolve-candidate label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}

.admin-head,
.admin-user-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-head h2,
.admin-create h3 {
  margin: 0;
  font-size: 15px;
}

.admin-users {
  display: grid;
  gap: 8px;
  max-height: 38vh;
  overflow: auto;
}

.admin-user {
  padding: 9px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.admin-user-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.admin-user-controls select {
  width: auto;
  min-width: 140px;
  flex: 1;
}

.user-status.disabled {
  color: #b91c1c;
}

.admin-create {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.admin-create label,
.login-card label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #475569;
}

/* Экран входа */
.login-page {
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: min(390px, 100%);
  padding: 24px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
}

.login-card h1 {
  margin: 0;
  font-size: 21px;
}

.login-card .subtitle {
  margin: 4px 0 20px;
  color: #64748b;
}

.login-card form {
  display: grid;
  gap: 8px;
}

.login-card .btn {
  margin-top: 8px;
}

.login-card .error {
  margin: 3px 0 0;
}

button:focus-visible,
select:focus-visible {
  outline: 2px solid #0b6bcb;
  outline-offset: 2px;
}

#sidebar h2 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #374151;
}

.note {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: #6b7280;
}

.warn-note {
  color: #92400e;
}

.empty {
  margin: 4px 0;
  font-size: 12px;
  color: #9ca3af;
}

/* ---------------------------------- Слои -------------------------------- */

.layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.chk {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.chk.disabled {
  color: #9ca3af;
  cursor: not-allowed;
}

/* Легенда цветов категорий (SPEC-2 П2). */

.legend {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #374151;
}

.swatch {
  flex: none;
  width: 14px;
  height: 10px;
  border-radius: 3px;
  border: 1.5px solid transparent;
}

/* Категории 2.5 (SPEC-3 П2/П3): договор — зелёный, решение — фиолетовый,
   аквакультура — синий; ГТС — оранжевый; проблемные — красный контур. */

.swatch-contract {
  background: rgba(16, 185, 129, 0.28);
  border-color: #047857;
}

.swatch-decision {
  background: rgba(139, 92, 246, 0.28);
  border-color: #6d28d9;
}

.swatch-aqua {
  background: rgba(14, 165, 233, 0.32);
  border-color: #0369a1;
}

.swatch-unknown {
  background: rgba(148, 163, 184, 0.32);
  border-color: #64748b;
}

.swatch-gts {
  background: rgba(245, 158, 11, 0.5);
  border-color: #b45309;
}

.swatch-inactive {
  background: #94a3b8;
  border-color: #64748b;
}

/* Проблемные координаты — прозрачная заливка, жирный красный пунктир. */
.swatch-problem {
  background: transparent;
  border: 2px dashed #dc2626;
}

/* Береговые линии НСПД — как на портале: сплошная тёмно-синяя линия. */
.swatch-shoreline {
  border-color: transparent;
  background: linear-gradient(#1f63a3, #1f63a3) center / 11px 2px no-repeat;
}

/* Слои НСПД: цвет контура и заливки совпадает с тем, как объект рисуется на карте. */
.swatch-nspd-parcel {
  border-color: #8a8a3a;
  background: linear-gradient(90deg,
    #f2eca2 0 33%, #f8c4b7 33% 66%, #a3c2f3 66% 100%);
}
.swatch-nspd-building { border-color: #7a4a92; background: rgba(201, 160, 220, 0.5); }
.swatch-nspd-structure { border-color: #b04a72; background: rgba(244, 143, 177, 0.5); }
.swatch-nspd-unfinished { border-color: #7a3a7a; background: rgba(176, 122, 176, 0.5); }
.swatch-nspd-zone { border-color: #6a5aa8; background: rgba(176, 160, 216, 0.35); }
.swatch-nspd-restrict { border-color: #a03226; background: rgba(208, 90, 74, 0.3); }
.swatch-nspd-nature { border-color: #2f7a6a; background: rgba(126, 201, 184, 0.45); }
.swatch-nspd-water { border-color: #3f6a9a; background: rgba(127, 176, 224, 0.4); }
.nspd-layers summary {
  cursor: pointer;
  font-weight: 600;
  margin: 8px 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#water-user-search {
  position: relative;
}

.results-actions,
.results-pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.results-pagination span {
  margin-right: auto;
  color: #64748b;
  font-size: 12px;
}

.results-table-wrap {
  max-width: 100%;
  max-height: min(360px, 45vh);
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.results-table-wrap table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.results-table-wrap th,
.results-table-wrap td {
  min-width: 100px;
  padding: 6px 8px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}

.results-table-wrap th {
  position: sticky;
  top: 0;
  background: #f8fafc;
}

.results-table-wrap td {
  max-width: 280px;
  overflow-wrap: anywhere;
}

.results-table-wrap .btn {
  min-height: 44px;
  white-space: nowrap;
}

.results-table-wrap:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Аккордеон «Формы ГВР» (SPEC-3 П4). */

#formsAccordion {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 6px 10px;
}

.forms-subhead {
  margin: 8px 0 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #64748b;
}

.form-chk {
  display: grid;
  grid-template-columns: 16px 16px minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 6px;
  margin: 3px 0;
}

.form-chk input {
  margin: 2px 0 0;
}

.form-chk .swatch {
  margin: 4px 0 0;
}

.form-chk-label {
  min-width: 0;
}

.cat-count {
  padding-top: 1px;
  white-space: nowrap;
  color: #94a3b8;
  font-size: 11px;
}

.form-note-item {
  margin: 3px 0;
  padding-left: 6px;
  border-left: 2px solid #e5e7eb;
  font-size: 11.5px;
  color: #6b7280;
}

.form-note-item.form-empty {
  border-left-color: #cbd5e1;
  color: #9ca3af;
}

.status-row {
  margin-top: 8px;
}

.geometry-mode-row {
  margin-top: 8px;
}

.status-row .chk {
  gap: 8px;
}

.status-row select {
  width: auto;
  flex: 1;
}

.geometry-mode-row select {
  width: auto;
  flex: 1;
  font-size: 12px;
}

/* ------------------------------ Формы и кнопки --------------------------- */

select,
input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: inherit;
  background: #fff;
}

select:focus,
input:focus {
  outline: 2px solid #bfdbfe;
  border-color: #0b6bcb;
}

.layer-row select {
  width: auto;
  flex: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
  margin-top: 8px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11.5px;
  color: #374151;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.btn {
  padding: 6px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #f8fafc;
  font-size: 13px;
  font-family: inherit;
  color: #1f2937;
  cursor: pointer;
}

.btn:hover {
  background: #eef2f7;
}

.btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn-primary {
  background: #0b6bcb;
  border-color: #0b6bcb;
  color: #fff;
}

.btn-primary:hover {
  background: #095aa9;
}

#pondPickBtn {
  margin-top: 8px;
  width: 100%;
}

#aqPickBtn,
#polyFinishBtn {
  flex: 1 1 auto;
}

/* Режимы указания участка (SPEC-2 П6): линия берега / полигон / линейка. */

.mode-tabs {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #f8fafc;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.mode-tab input {
  width: auto;
  margin: 0;
  accent-color: #0b6bcb;
}

.mode-tab:hover {
  background: #eef2f7;
}

.mode-tab:has(input:checked) {
  background: #dbeafe;
  border-color: #0b6bcb;
  color: #0b6bcb;
  font-weight: 600;
}

#aqModeStatus {
  color: #0f766e;
  font-weight: 600;
}

/* Поиск по справочнику водных объектов 1.9 (SPEC-2 П1). */

.search-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.search-row input {
  flex: 1;
}

.search-row .btn {
  flex: none;
}

#woResults {
  margin-top: 6px;
}

/* --------------------------- Секции-проверки ----------------------------- */

details > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  user-select: none;
}

details[open] > summary {
  margin-bottom: 4px;
}

/* ------------------------------- Результаты ------------------------------ */

.verdict {
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
}

.verdict-free {
  background: #dcfce7;
  color: #166534;
}

.verdict-warning {
  background: #fef3c7;
  color: #92400e;
}

.verdict-restricted {
  background: #fee2e2;
  color: #991b1b;
}

.badges {
  margin-bottom: 8px;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  margin: 0 4px 4px 0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-red {
  background: #fee2e2;
  color: #991b1b;
}

.badge-green {
  background: #dcfce7;
  color: #166534;
}

.badge-amber {
  background: #fef3c7;
  color: #92400e;
}

.badge-blue {
  background: #dbeafe;
  color: #1e40af;
}

.badge-gray {
  background: #f1f5f9;
  color: #475569;
}

.warn {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 12px;
}

.error {
  padding: 8px 10px;
  border-radius: 8px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 12.5px;
}

.res-sec {
  margin-top: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 6px 8px;
}

.res-sec > summary {
  font-size: 12.5px;
}

.tbl-wrap {
  margin-top: 6px;
  max-height: 240px;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 11.5px;
}

th,
td {
  padding: 4px 6px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #374151;
  white-space: nowrap;
}

.row-active {
  font-weight: 700;
}

/* Строка результата с проблемными координатами (SPEC-3 П5). */
.row-problem td:first-child {
  border-left: 3px solid #dc2626;
}

.row-problem td:first-child::before {
  content: "⚠ ";
  color: #dc2626;
}

/* --------------------------------- Футер --------------------------------- */

#attribution {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
  font-size: 11px;
  color: #6b7280;
}

#attribution a {
  color: #0b6bcb;
}

/* ---------------------------------- Карта -------------------------------- */

#map-wrap {
  position: relative;
  flex: 1;
  height: 100%;
  min-width: 0;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
}

#map-basemap {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 25;
  padding: 4px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  font-size: 13px;
}
#map-basemap [role="group"] { display: flex; gap: 4px; }
#map-basemap button {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #1f2937;
  font: inherit;
  cursor: pointer;
}
#map-basemap button[aria-pressed="true"] { background: #0b6bcb; border-color: #0b6bcb; color: #fff; }
#map-basemap button:disabled { opacity: .55; cursor: default; }
#map-basemap button:focus-visible { outline: 2px solid #0b6bcb; outline-offset: 2px; }
#basemap-status { max-width: 220px; margin: 6px 2px 2px; line-height: 1.4; }
@media (max-width: 700px) { #map-basemap button { min-height: 44px; } }

body.picking #map,
body.picking #map * {
  cursor: crosshair !important;
}

#modeHint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  padding: 6px 14px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 12.5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  white-space: nowrap;
}

#map-tools {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 25;
  padding: 4px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  color: #1f2937;
  font-size: 13px;
}
.map-tool-buttons, .map-tool-actions { display: flex; gap: 4px; }
#map-tools button, #map-copy button {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #1f2937;
  font: inherit;
  cursor: pointer;
}
#map-tools .map-tool-buttons button { width: 36px; height: 36px; padding: 7px; color: #0b6bcb; }
.map-tool-buttons svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#measure-panel { position: absolute; top: calc(100% + 5px); right: 0; width: min(248px, calc(100vw - 48px)); padding: 8px; box-sizing: border-box; background: #fff; border: 1px solid #d1d5db; border-radius: 8px; }
#map-tools button[aria-expanded="true"] { background: #0b6bcb; border-color: #0b6bcb; color: #fff; }
@media (max-width: 700px) { #map-tools .map-tool-buttons button { width: 44px; height: 44px; padding: 11px; } }
#map-tools button[aria-pressed="true"] { background: #0b6bcb; border-color: #0b6bcb; color: #fff; }
#map-tools button:disabled { opacity: .5; cursor: default; }
#map-tools button:focus-visible, #map-copy button:focus-visible { outline: 2px solid #0b6bcb; outline-offset: 2px; }
#measure-result { margin-top: 0; line-height: 1.4; overflow-wrap: anywhere; }
#measure-help { margin: 6px 0; font-size: 12px; line-height: 1.4; }
#measure-help:empty { display: none; }
.map-tool-actions { margin-top: 8px; }
.map-tool-actions button { flex: 1; padding-inline: 4px !important; font-size: 12px !important; }
body.measuring #map, body.measuring #map * { cursor: crosshair !important; }
#map-copy {
  position: absolute;
  bottom: 48px;
  left: 12px;
  z-index: 26;
  width: min(310px, calc(100% - 24px));
  box-sizing: border-box;
  padding: 10px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #1f2937;
  font-size: 13px;
}
#map-copy-status { display: block; margin-right: 30px; margin-bottom: 6px; }
#map-copy-value { width: 100%; box-sizing: border-box; font: inherit; padding: 6px; }
#map-copy-close { position: absolute; right: 6px; top: 6px; }

/* Заглушка без ключа API. */

#map-stub {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #eef2f7;
}

.stub-card {
  max-width: 480px;
  padding: 22px 26px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  font-size: 13px;
}

.stub-card h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.stub-card code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #f1f5f9;
  font-size: 12px;
}

#stubError {
  padding: 6px 10px;
  border-radius: 6px;
  background: #fee2e2;
  color: #991b1b;
}

/* --------------------------- Маркеры и попапы ---------------------------- */
/* DOM-элементы внутри YMapMarker: точка привязки — координата, центрируем
   сдвигом transform. */

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
  cursor: pointer;
}

.dot-wu {
  background: #0b6bcb;
}

/* Категории 2.5 (SPEC-3 П2/П3): договор — зелёный, решение — фиолетовый,
   аквакультура — синий. */

.dot-wu-contract {
  background: #047857;
}

.dot-wu-decision {
  background: #6d28d9;
}

.dot-wu-aqua {
  background: #0369a1;
}

.dot-wu-unknown {
  background: #64748b;
}

.dot-inactive {
  background: #94a3b8;
}

/* Проблемные координаты (SPEC-3 П5): красная обводка точечного маркера. */
.dot-problem {
  border-color: #dc2626;
  box-shadow: 0 0 0 1.5px #dc2626, 0 0 3px rgba(0, 0, 0, 0.45);
}

/* Выбросная координата поверх заливки участка. */
.dot-problem-point {
  width: 15px;
  height: 15px;
  background: #fff;
  border: 3px solid #dc2626;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #dc2626;
  cursor: pointer;
  z-index: 5;
}

.dot-conflict {
  background: #dc2626;
}

.dot-nearby {
  background: #d97706;
}

/* ГТС — оранжевые точки (SPEC-3 П2). */

.dot-gts {
  background: #f59e0b;
}

.dot-center {
  background: #0f766e;
}

/* Подпись дистанции сегмента линейки (v3; в v2.1 — stretchy-иконка). */

.map-label {
  transform: translate(-50%, -50%);
  padding: 1px 7px;
  border-radius: 6px;
  background: #111827;
  color: #fff;
  font-size: 10.5px;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.pick-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transform: translate(-50%, -100%);
  pointer-events: none;
}

.pick-label {
  padding: 1px 7px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 10.5px;
  white-space: nowrap;
}

.pick-pin {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #111827;
  border: 2px solid #fff;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
}

.map-popup {
  position: relative;
  transform: translate(-50%, calc(-100% - 12px));
  width: max-content;
  max-width: 300px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  font-size: 12px;
  cursor: default;
}

.pp-title {
  font-weight: 700;
  font-size: 12px;
  margin: 0 18px 6px 0;
}

/* Плашка проблемных координат в попапе/карточке (SPEC-3 П5). */
.pp-problem {
  margin: 0 0 6px;
  padding: 4px 7px;
  border-radius: 6px;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  font-size: 11px;
  font-weight: 700;
}

.geometry-toggle {
  width: 100%;
  margin: 0 0 7px;
  padding: 5px 7px;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.geometry-toggle:hover {
  background: #dbeafe;
}

.pp-row {
  display: flex;
  gap: 8px;
  padding: 1.5px 0;
}

.pp-row span {
  flex: 0 0 96px;
  color: #6b7280;
}

.pp-row b {
  font-weight: 600;
  word-break: break-word;
}

.popup-close {
  position: absolute;
  top: 4px;
  right: 6px;
  border: none;
  background: none;
  font-size: 16px;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
}

.popup-close:hover {
  color: #374151;
}

/* Режим без карты: прячем элементы, которым нужна карта. */

body.no-map .map-only {
  display: none !important;
}

/* ------------------------------ Адаптивность ----------------------------- */

@media (max-width: 800px) {
  body {
    flex-direction: column;
  }

  #sidebar {
    width: 100%;
    min-width: 0;
    height: 48%;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
  }

  #map-wrap {
    height: 52%;
  }
}

/* Порядок меню совпадает с DOM; раскрытие не сбрасывает фильтры карты. */
#mapDetails > summary,
#importsDetails > summary {
  min-height: 44px;
  padding: 10px 0;
}

#mapDetails > summary:focus-visible,
#importsDetails > summary:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
  border-radius: 4px;
}

#importsDetails > summary {
  font-size: 15px;
}

#importsDetails[open] > summary {
  margin-bottom: 8px;
}

#app-header {
  margin-bottom: 10px;
}

.account-details {
  margin: 16px 0;
}

.account-details dt {
  color: #64748b;
  margin-top: 8px;
}

.account-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Номера вершин измерения: ярко-синий фон и белые цифры. */
.map-label.measure-point { min-width: 22px; min-height: 22px; box-sizing: border-box; padding: 2px 6px; background: #0066ff; color: #fff; font-size: 12px; font-weight: 600; line-height: 18px; border-radius: 11px; box-shadow: none; }
.measure-point-text { color: #fff; font-weight: 600; }
/* Рабочая поверхность: карта, системная типографика и спокойная иерархия. */
:root {
  --ui-canvas: #f5f5f7;
  --ui-surface: #fff;
  --ui-field: #eaecef;
  --ui-text: #1d1d1f;
  --ui-secondary: #62656c;
  --ui-line: #dfe1e6;
  --ui-accent: #0068d9;
  --ui-selected: #e5efff;
  --ui-contract: #188d75;
  --ui-decision: #6865ca;
  --ui-aqua: #2585c5;
}

body {
  height: 100dvh;
  flex-direction: row;
  overflow: hidden;
  background: var(--ui-canvas);
  color: var(--ui-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.48;
  -webkit-font-smoothing: antialiased;
}

#sidebar {
  flex: 0 0 336px;
  width: 336px;
  min-width: 0;
  height: 100%;
  padding: 0;
  gap: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #bfc3cb transparent;
  background: transparent;
  border: 0;
}

#workspace-menu { height: auto; min-height: 100%; flex-shrink: 0; }
.workspace-menu-toggle { display: none; }
.workspace-menu-body {
  height: auto;
  overflow: visible;
  padding: 24px 20px 18px;
}

.workspace-brand { display: flex; align-items: center; gap: 11px; padding: 0 0 22px; }
.workspace-brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #e2edfb;
  color: #0063c8;
}
.workspace-brand-mark svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.workspace-brand h1 { font-size: 21px; font-weight: 650; line-height: 1.2; letter-spacing: -.025em; margin: 0; }
.workspace-brand p { color: var(--ui-secondary); font-size: 11px; line-height: 1.5; margin: 4px 0 0; }

.workspace-menu-body > section {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 18px 0;
  margin: 0;
  border-bottom: 1px solid var(--ui-line);
}
.workspace-menu-body > #account-bar { padding: 0 0 18px; }
.account-bar { gap: 8px; align-items: center; }
#account-login { font-size: 13px; font-weight: 600; }
.account-role { color: var(--ui-secondary); font-size: 11px; }
.account-actions { gap: 3px; }
.account-actions .btn { border: 0; background: transparent; color: var(--ui-secondary); font-size: 11px; min-height: 32px; padding: 5px 7px; }
.account-actions .btn:hover { color: var(--ui-text); background: #e7e9ee; }

#sidebar h2 { color: var(--ui-text); font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; margin: 0 0 8px; }
#sidebar input:not([type="checkbox"]):not([type="radio"]),
#sidebar select, #sidebar textarea {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--ui-field);
  color: var(--ui-text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
}
#sidebar input::placeholder { color: #62656c; opacity: 1; }
#sidebar select { padding-right: 7px; cursor: pointer; }
#sidebar input:focus, #sidebar select:focus, #sidebar textarea:focus { background: var(--ui-surface); border-color: var(--ui-accent); }
#sidebar :focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 3px; }
.search-row { gap: 6px; }
.search-row input { flex: 1; }
.search-row .btn { flex: 0 0 auto; padding: 8px 12px; min-height: 40px; font-size: 12px; }
.btn { min-height: 38px; border: 0; border-radius: 10px; background: #e7e9ee; color: var(--ui-text); font-size: 13px; font-weight: 500; }
.btn:hover { background: #dde0e6; }
.btn-primary { background: var(--ui-accent); color: #fff; }
.btn-primary:hover { background: #005bbd; }
button, input, select, textarea { transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease; }
.note { color: var(--ui-secondary); font-size: 11px; line-height: 1.5; }
#location-help, #address-help { margin-top: 7px; }
.address-result { background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 10px; padding: 11px; }
.address-result:hover, .address-result[aria-pressed="true"] { background: var(--ui-selected); border-color: #b2ceef; }
.address-result small { color: var(--ui-secondary); }

#mapDetails > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  padding: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.015em;
  cursor: pointer;
  list-style: none;
}
#mapDetails > summary::-webkit-details-marker { display: none; }
.workspace-summary-caption { color: var(--ui-secondary); font-size: 11px; font-weight: 500; letter-spacing: 0; }
.workspace-summary-caption::after { content: "⌄"; display: inline-block; padding-left: 8px; font-size: 15px; }
#mapDetails:not([open]) .workspace-summary-caption::after { transform: rotate(-90deg); }
#mapDetails[open] > summary { margin-bottom: 18px; }
#formsAccordion { border: 0; border-radius: 0; padding: 0; margin-top: 18px; }
#formsAccordion > summary { min-height: 36px; padding: 6px 0; font-size: 13px; font-weight: 600; }
.forms-subhead { color: var(--ui-secondary); font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0; margin: 4px 0 6px; }
.form-chk { grid-template-columns: 18px 16px minmax(0,1fr) auto; min-height: 40px; gap: 7px; padding: 8px 0; margin: 0; align-items: center; font-size: 12px; line-height: 1.35; }
.form-chk input { width: 16px; height: 16px; margin: 0; accent-color: var(--ui-accent); }
.form-chk .swatch { margin: 0; }
.cat-count { color: var(--ui-secondary); font-size: 10px; padding: 0; font-variant-numeric: tabular-nums; }
.form-note-item { border: 0; padding: 0; color: var(--ui-secondary); font-size: 11px; line-height: 1.5; margin: 8px 0 16px; }
.layer-row { margin: 14px 0 0; }
.layer-row .chk { display: block; width: 100%; font-size: 11px; font-weight: 500; color: var(--ui-secondary); }
.layer-row select { margin-top: 5px; }
.swatch { width: 13px; height: 10px; border-width: 1px; border-radius: 3px; }
.swatch-contract { border-color: var(--ui-contract); background: #d9eee9; }
.swatch-decision { border-color: var(--ui-decision); background: #e6e5f5; }
.swatch-aqua { border-color: var(--ui-aqua); background: #dcecf6; }
.swatch-unknown { border-color: #758194; background: #e5e9ef; }
.swatch-gts { border-color: #a06b1b; background: #f5e6ca; }
.swatch-pond, .dot-pond { background: #0284a8; }
#pond-credit { margin: 2px 3px; font-size: 10px; line-height: 1.3; }
#pond-credit a { color: #425261; }
.swatch-pond { border-radius: 50%; border-color: #006683; width: 13px; height: 13px; }
#pond-layer { border-top: 1px solid var(--ui-line, #d6d6dc); padding-top: 6px; }
#pond-controls > label { font-size: 12px; color: var(--ui-secondary); }
#pond-controls select, #pond-query { width: 100%; }
#pond-register { margin: 10px 0; }
#pond-register summary { cursor: pointer; font-size: 13px; font-weight: 600; padding: 8px 0; }
#pond-list { margin: 4px 0; }
.pond-result { display: grid; gap: 2px; text-align: left; width: 100%; min-height: 44px; padding: 7px 2px; background: transparent; border: 0; border-bottom: 1px solid #d6d6dc; color: inherit; font: inherit; cursor: pointer; overflow-wrap: anywhere; }
.pond-result:hover, .pond-result:focus-visible { background: #e9f4f7; }
.pond-result span { color: var(--ui-secondary); font-size: 12px; }
.swatch-problem { border: 1.5px dashed #c74444; background: transparent; }
.map-reference { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--ui-line); }
.map-reference > summary { min-height: 34px; font-size: 11px; font-weight: 500; color: var(--ui-secondary); }
.legend { margin: 8px 0 14px; gap: 7px; }
.legend-item { color: var(--ui-secondary); font-size: 11px; line-height: 1.4; }
#attribution { margin-top: 4px; padding-top: 16px; border: 0; color: var(--ui-secondary); font-size: 10px; }
#attribution summary { min-height: 32px; color: var(--ui-secondary); font-size: 11px; font-weight: 500; }
#attribution a { color: var(--ui-accent); }
#attribution details > div { margin-top: 7px; overflow-wrap: anywhere; }

#map-wrap { height: auto; min-height: 0; margin: 12px 12px 12px 0; border-radius: 20px; isolation: isolate; background: #e2e9eb; }
#map-basemap, #map-tools { top: 16px; padding: 4px; background: rgba(255,255,255,.94); border: 0; border-radius: 12px; box-shadow: 0 3px 14px rgba(27,40,60,.12); }
@supports (backdrop-filter: blur(12px)) { #map-basemap, #map-tools { background: rgba(255,255,255,.85); backdrop-filter: blur(16px) saturate(1.25); } }
#map-basemap { left: 16px; }
#map-tools { right: 16px; }
#map-basemap [role="group"], .map-tool-buttons { gap: 2px; }
#map-basemap button { min-height: 36px; padding: 7px 12px; border: 0; border-radius: 9px; color: #4b5058; background: transparent; font-size: 12px; font-weight: 500; }
#map-basemap button:hover { background: #e5eaf1; }
#map-basemap button[aria-pressed="true"] { color: #fff; background: var(--ui-accent); border: 0; }
#map-tools .map-tool-buttons button { width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--ui-accent); }
#map-tools .map-tool-buttons button:hover { background: var(--ui-selected); }
#map-tools button[aria-expanded="true"], #map-tools button[aria-pressed="true"] { background: var(--ui-accent); color: #fff; }
#measure-panel { top: calc(100% + 8px); width: min(272px,calc(100vw - 48px)); padding: 14px; border: 0; border-radius: 14px; box-shadow: 0 7px 24px rgba(27,40,60,.14); }
#measure-result { color: var(--ui-text); font-size: 13px; font-weight: 600; }
#measure-help { color: var(--ui-secondary); font-size: 11px; }
#measure-panel button { min-height: 36px; border: 0; background: #edf0f4; color: var(--ui-text); border-radius: 8px; padding: 7px 10px; font-size: 11px; }
.map-tool-actions { gap: 5px; }
#map-copy { border: 0; border-radius: 14px; padding: 15px; box-shadow: 0 7px 24px rgba(27,40,60,.14); color: var(--ui-text); }
#map-copy-value { border-radius: 8px; border: 1px solid var(--ui-line); padding: 8px; }

.admin-dialog, .imports-dialog, .records-dialog { padding: 24px; border: 0; border-radius: 20px; background: var(--ui-surface); color: var(--ui-text); box-shadow: 0 24px 64px rgba(24,35,50,.22); }
.admin-dialog::backdrop, .imports-dialog::backdrop, .records-dialog::backdrop { background: rgba(20,29,42,.32); }
.admin-user { border-color: var(--ui-line); border-radius: 12px; padding: 13px; }
.login-page { background: var(--ui-canvas); overflow: auto; }
.login-card { padding: 36px; border: 0; border-radius: 22px; box-shadow: 0 12px 42px rgba(30,42,60,.09); }
.login-card h1 { font-size: 25px; font-weight: 650; letter-spacing: -.025em; }
.login-card .subtitle { color: var(--ui-secondary); font-size: 13px; margin-top: 7px; }
.login-card label { color: var(--ui-secondary); font-size: 12px; }
.login-card input { min-height: 44px; border: 1px solid var(--ui-line); border-radius: 10px; padding: 10px 12px; background: #f8f9fb; font: inherit; }
.login-card .btn { min-height: 44px; border-radius: 10px; }

@media (min-width: 761px) {
  #workspace-menu:not([open]) > .workspace-menu-body { display: block; }
}

@media (max-width: 760px) {
  body { flex-direction: column; }
  #sidebar { flex: none; width: 100%; height: auto; overflow: visible; border: 0; }
  #workspace-menu { height: auto; min-height: 0; }
  .workspace-menu-toggle { display: flex; align-items: center; justify-content: space-between; min-height: 64px; padding: 13px 18px; margin: 0 !important; list-style: none; cursor: pointer; }
  .workspace-menu-toggle::-webkit-details-marker { display: none; }
  .workspace-mobile-title { font-size: 19px; font-weight: 650; letter-spacing: -.025em; }
  .workspace-menu-caption { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ui-secondary); }
  .workspace-menu-caption svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
  #workspace-menu[open] .workspace-menu-caption svg { transform: rotate(180deg); }
  .workspace-menu-body { height: auto; max-height: 38dvh; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #bfc3cb transparent; padding: 0 18px 16px; }
  .workspace-brand { display: none; }
  .workspace-menu-body > section { padding: 14px 0; }
  .workspace-menu-body > #account-bar { padding-bottom: 12px; }
  .account-actions .btn { min-height: 40px; }
  #sidebar input:not([type="checkbox"]):not([type="radio"]), #sidebar select, #sidebar textarea { min-height: 44px; font-size: 16px; }
  .search-row .btn { min-height: 44px; }
  .form-chk { min-height: 44px; font-size: 13px; }
  #map-wrap { flex: 1; height: auto; min-height: 0; margin: 0 8px 8px; border-radius: 16px; }
  #map-basemap { left: 12px; top: 12px; }
  #map-tools { right: 12px; top: 12px; }
  #map-basemap button { min-height: 44px; padding: 8px 11px; }
  #map-tools .map-tool-buttons button { width: 44px; height: 44px; padding: 11px; }
  #map-copy { max-width: calc(100% - 24px); }
  .login-page { padding: 18px; }
  .login-card { padding: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Плашки «Договор · организация» поверх акваторий: один чекбокс в панели
   слоёв прячет их, чтобы освободить обзор. Строка стоит выше списка слоёв,
   поэтому видна и при свёрнутом разделе. */
.labels-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 6px 0 12px;
  padding: 9px 11px;
  border: 1px solid var(--ui-line, #d6d6dc);
  border-radius: 8px;
  background: var(--ui-surface, #fff);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
}

.labels-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: none;
  accent-color: var(--ui-accent, #0a84ff);
}

.labels-toggle:hover { border-color: #b9bcc4; }

@media (max-width: 760px) {
  .labels-toggle { font-size: 13px; padding: 10px 12px; }
}

/* Доверенные браузеры: галочка на входе и список устройств в кабинете. */
.login-card label.remember {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.login-card label.remember input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ui-accent, #0a84ff);
}
.login-card .hint {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ui-secondary, #5f6b7a);
}
.account-devices {
  margin-top: 22px;
  border-top: 1px solid var(--ui-line, #d6d6dc);
  padding-top: 16px;
}
.account-devices h3 {
  margin: 0 0 6px;
  font-size: 15px;
}
.account-devices-list {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}
.account-device {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--ui-line, #d6d6dc);
  border-radius: 8px;
  background: var(--ui-surface, #fff);
}
.account-device-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.account-device-info strong {
  font-size: 13px;
}
.account-device-info small {
  color: var(--ui-secondary, #5f6b7a);
  font-size: 11px;
}
.account-device .btn {
  flex: none;
}
.account-device-empty {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ui-secondary, #5f6b7a);
}
.admin-remember {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
@media (max-width: 760px) {
  .account-device {
    flex-direction: column;
    align-items: flex-start;
  }
}
.account-device .btn {
  flex: none;
  border: 1px solid var(--ui-line, #d6d6dc);
  background: var(--ui-surface, #fff);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

/* Разделы слоёв НСПД сворачиваются, как дерево слоёв на портале. */
.nspd-group {
  margin: 2px 0 6px;
}
.nspd-group > summary {
  cursor: pointer;
  list-style: none;
  color: var(--ui-secondary);
  font-size: 11px;
  margin: 6px 0 4px;
}
.nspd-group > summary::-webkit-details-marker { display: none; }
.nspd-group > summary::before {
  content: "▸ ";
  display: inline-block;
  width: 12px;
}
.nspd-group[open] > summary::before { content: "▾ "; }

/* Предупреждение поверх карты: слоя нет на портале НСПД. */
.map-warning {
  position: absolute;
  left: 16px;
  top: 16px;
  z-index: 30;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 330px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #e6d3ab;
  border-left: 4px solid #d08a2a;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 35, 45, 0.16);
  font-size: 13px;
}
.map-warning[hidden] { display: none; }
.map-warning b { display: block; margin-bottom: 4px; color: #7a4a10; }
.map-warning p { margin: 0; color: #5b6b70; line-height: 1.45; }
.map-warning-close {
  background: none;
  border: 0;
  padding: 0 2px;
  font-size: 18px;
  line-height: 1;
  color: #8a9aa0;
  cursor: pointer;
}
.map-warning-close:hover { color: #33474d; }

/* Профиль в правом верхнем углу: свёрнут в одну кнопку. */
.top-account {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 40;
}
.account-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #dbe3e6;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(15, 35, 45, 0.08);
  font-size: 13px;
  color: #1f3a40;
  cursor: pointer;
}
.account-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}
.account-toggle[aria-expanded="true"] {
  border-color: #8fb6bd;
}
.account-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 230px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #dbe3e6;
  border-radius: 10px;
  box-shadow: 0 10px 26px rgba(15, 35, 45, 0.14);
  font-size: 13px;
}
.account-panel[hidden] { display: none; }
.account-who { display: flex; flex-direction: column; gap: 2px; }
.account-role { color: #6b7f85; font-size: 12px; }
.account-actions { display: flex; flex-direction: column; gap: 6px; }
.account-actions .btn { text-align: left; }
/* Переключатель плашек и подложки — компактные кнопки на карте. */
#map-side-controls {
  position: absolute;
  right: 14px;
  top: 98px;
  z-index: 25;
}
.map-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid #dbe3e6;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(15, 35, 45, 0.1);
  font-size: 12px;
  cursor: pointer;
}
.pond-sub {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 0 4px;
}
.popup-table {
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 12px;
}
.popup-table td {
  padding: 2px 8px 2px 0;
  vertical-align: top;
}
.popup-table td:first-child {
  color: #6b7f85;
  white-space: nowrap;
}
.popup-sub {
  color: #6b7f85;
  font-size: 11px;
  margin-top: 2px;
}

/* Правая колонка карты: кнопка профиля сверху, под ней инструменты и плашки. */
#map-tools {
  top: 64px;
  right: 12px;
}
#map-side-controls {
  top: 118px;
  right: 12px;
}
@media (max-width: 700px) {
  #map-tools { top: 68px; right: 12px; }
  #map-side-controls { top: 126px; right: 12px; }
}

/* Вложенный раздел «Пруды»: сворачивается, радиокнопки выровнены влево. */
.gvr-sub { margin: 4px 0 8px; }
.gvr-sub > summary {
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  color: var(--ui-secondary);
  padding: 4px 0;
}
.gvr-sub > summary::-webkit-details-marker { display: none; }
.gvr-sub > summary::before {
  content: "▸ ";
  display: inline-block;
  width: 12px;
}
.gvr-sub[open] > summary::before { content: "▾ "; }
.pond-sub {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 10px;
}
.pond-sub label.chk {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  text-align: left;
  width: 100%;
  font-size: 12.5px;
  line-height: 1.35;
  color: #33474d;
}
.pond-sub input[type="radio"] {
  flex: none;
  margin: 2px 0 0;
  accent-color: var(--ui-accent);
}

/* Плашка выбора региона поверх карты. */
.region-prompt {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 30, 38, 0.35);
}
.region-prompt[hidden] { display: none; }
.region-prompt-card {
  width: min(420px, calc(100vw - 32px));
  padding: 22px 24px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(10, 25, 35, 0.28);
  font-size: 14px;
}
.region-prompt-card h2 {
  margin: 0 0 8px;
  font-size: 19px;
}
.region-prompt-note {
  margin: 0 0 14px;
  color: #5b6b70;
  line-height: 1.45;
}
.region-prompt-card select {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #cfd9dd;
  border-radius: 9px;
  background: #fff;
}
.region-prompt-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.region-prompt-actions .btn { flex: 1; }

/* Радиокнопки прудов: не растягиваться общим правилом input. */
    /* Общее правило input{width:100%} растягивало радиокнопки в овал — возвращаем размер. */
    .pond-sub input[type="radio"],
    #pond-controls input[type="radio"] {
      width: 16px !important;
      height: 16px !important;
      min-width: 16px !important;
      min-height: 0 !important;
      max-width: 16px !important;
      padding: 0 !important;
      border: 0 !important;
      border-radius: 50% !important;
      background: none !important;
      flex: 0 0 16px !important;
      margin: 2px 0 0 0 !important;
      accent-color: var(--ui-accent, #0b6bcb);
    }
    .pond-sub label.chk { flex-wrap: nowrap; }

/* Кнопка «скопировать» в карточках объектов НСПД. */
/* Кнопка «скопировать» рядом с номером и адресом. */
.copy-btn {
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.6;
  font-family: inherit;
  color: #0b6bcb;
  background: #eef4fd;
  border: 1px solid #cfe0f6;
  border-radius: 6px;
  cursor: pointer;
  vertical-align: middle;
  white-space: nowrap;
}
.copy-btn:hover { background: #e2edfc; }
.copy-btn.copied { color: #1a7f43; background: #e8f6ee; border-color: #bfe3cd; }

/* Крупные разделы панели: «Слои ГВР» и «Слои НСПД». */
#sec-layers > details > summary,
#sec-layers > details.nspd-layers > summary,
#formsAccordion > summary,
#nspdLayers > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #14313a;
  padding: 10px 0 8px;
  border-bottom: 1px solid #dfe7ea;
  margin-bottom: 8px;
}
#formsAccordion > summary::before,
#nspdLayers > summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #1f6f8b;
  transform: rotate(-90deg);
  transition: transform 0.15s ease;
  flex: none;
}
#formsAccordion[open] > summary::before,
#nspdLayers[open] > summary::before {
  transform: rotate(0deg);
}

/* Подменю разделов чуть крупнее и акцентнее. */
#formsAccordion .form-chk-label,
#nspdLayers .form-chk-label {
  font-size: 13px;
  color: #1f3a40;
}
#formsAccordion .gvr-sub > summary,
#nspdLayers .nspd-group > summary {
  font-size: 12.5px;
  font-weight: 600;
  color: #1f6f8b;
  display: flex;
  align-items: center;
  gap: 6px;
}
#formsAccordion .gvr-sub > summary::before,
#nspdLayers .nspd-group > summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid #1f6f8b;
  transform: rotate(-90deg);
  transition: transform 0.15s ease;
  flex: none;
}
#formsAccordion .gvr-sub[open] > summary::before,
#nspdLayers .nspd-group[open] > summary::before {
  transform: rotate(0deg);
}

/* Цвета образцов ЗОУИТ по группам — как на портале. */
.swatch-zouit-heritage { border-color: #3f7a3f; background: rgba(127, 179, 127, 0.4); }
.swatch-zouit-energy { border-color: #9a7a1a; background: rgba(224, 192, 96, 0.45); }
.swatch-zouit-nature { border-color: #2f7a6a; background: rgba(143, 208, 192, 0.45); }
.swatch-zouit-guarded { border-color: #a03226; background: rgba(208, 90, 74, 0.4); }
.swatch-zouit-other { border-color: #3f6a9a; background: rgba(127, 176, 224, 0.45); }

/* Заметная кнопка-стрелка у разделов. */
#formsAccordion > summary::before,
#nspdLayers > summary::before {
  content: "";
  width: 20px;
  height: 20px;
  border: 1px solid #cfe0e8;
  border-radius: 6px;
  background: #eef5f8 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M6 3.5 10.5 8 6 12.5' fill='none' stroke='%231f6f8b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / 12px 12px no-repeat;
  transform: none;
  transition: transform 0.18s ease, background-color 0.18s ease;
  flex: none;
}
#formsAccordion[open] > summary::before,
#nspdLayers[open] > summary::before {
  transform: rotate(90deg);
}
#formsAccordion .gvr-sub > summary::before,
#nspdLayers .nspd-group > summary::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 1px solid #d6e4ea;
  border-radius: 5px;
  background: #f2f8fa url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M6 3.5 10.5 8 6 12.5' fill='none' stroke='%231f6f8b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / 10px 10px no-repeat;
  transform: none;
  transition: transform 0.18s ease;
  flex: none;
}
#formsAccordion .gvr-sub[open] > summary::before,
#nspdLayers .nspd-group[open] > summary::before {
  transform: rotate(90deg);
}

.hidden-filters { display: none !important; }

/* Компактный верхний блок панели: логотип, поиск и регион ближе друг к другу. */
.workspace-menu-body { padding: 12px 16px 10px; }
.workspace-brand { padding: 0 0 10px; gap: 9px; }
.workspace-brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.workspace-brand-mark svg { width: 24px; height: 24px; }
.workspace-brand h1 { font-size: 18px; }
.workspace-brand p { font-size: 10.5px; margin: 1px 0 0; line-height: 1.3; }
.workspace-menu-body > section { padding: 10px 0; }
#sec-search h2, #sec-region h2 { margin: 0 0 6px; font-size: 11.5px; }
#sec-search .search-row input,
#sec-region select { min-height: 36px; }
#sec-search .search-row .btn { min-height: 36px; padding: 0 14px; }
#sec-search .note { margin: 4px 0 0; font-size: 10.5px; }
#sec-search .note:empty { display: none; }
#sec-search { padding-top: 10px; }
#sec-region { padding-top: 8px; }

/* Чётче иерархия: крупные разделы заметно больше подразделов. */
#formsAccordion > summary,
#nspdLayers > summary {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 12px 0 9px;
}
#formsAccordion .gvr-sub > summary,
#nspdLayers .nspd-group > summary {
  font-size: 13.5px;
  font-weight: 600;
}
#formsAccordion .form-chk-label,
#nspdLayers .form-chk-label {
  font-size: 13px;
}

/* Береговые линии — основной слой на этом этапе: выделяем в списке. */
.shore-primary > summary {
  color: #0b5c8a;
}
.shore-primary > summary::before {
  border-color: #b7d9ea !important;
  background-color: #e4f2fa !important;
}
.shore-primary .form-chk-label {
  color: #0b5c8a;
  font-weight: 600;
}

/* Картоосновы портала НСПД под кнопками Схема/Спутник. */
#nspd-basemaps {
  margin-top: 6px;
  font-size: 12px;
}
#nspd-basemaps > summary {
  cursor: pointer;
  list-style: none;
  padding: 6px 8px;
  border-radius: 8px;
  color: #1f6f8b;
  background: #eef5f8;
}
#nspd-basemaps > summary::-webkit-details-marker { display: none; }
#nspd-basemaps[open] > summary { border-radius: 8px 8px 0 0; }
#nspd-basemaps div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  background: #fff;
  border: 1px solid #dbe6ea;
  border-radius: 0 0 8px 8px;
}
#nspd-basemaps button {
  text-align: left;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  color: #1f3a40;
  cursor: pointer;
}
#nspd-basemaps button:hover { background: #eef5f8; }
#nspd-basemaps button[aria-pressed="true"] { background: #1f6f8b; color: #fff; }

/* Подсказки адреса под строкой поиска. */
#sec-search form { position: relative; }
.unified-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 45;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
  background: #ffffff;
  border: 1px solid #dbe3e6;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15, 35, 45, 0.16);
}
.unified-suggest[hidden] { display: none; }
.unified-item {
  display: block;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  font-size: 12.5px;
  line-height: 1.35;
  color: #1f3a40;
  cursor: pointer;
}
.unified-item:hover { background: #eef5f8; }
.unified-item small { display: block; color: #6b7f85; font-size: 11px; margin-top: 2px; }

/* Значение и кнопка «скопировать» в одну строку. */
.pp-row .pp-value {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.pp-row .pp-value > b {
  display: inline;
  flex: 0 1 auto;
}
.pp-row .pp-value .copy-btn {
  margin-left: 0;
  flex: 0 0 auto;
}

/* У видов земельных участков цвет берётся с карты, поэтому образец в списке не нужен. */
.form-chk.no-swatch { grid-template-columns: 18px minmax(0, 1fr) auto; }
.form-chk.no-swatch .swatch { display: none; }

/* Кнопка очистки внутри строки поиска. */
.search-field { position: relative; flex: 1 1 auto; display: block; min-width: 0; }
.search-field input { padding-right: 34px; }
.search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #e6edf1;
  color: #4a5d65;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.search-clear:hover { background: #d5e0e6; color: #1f3a40; }
.search-clear[hidden] { display: none; }

/* Панель статуса выбранных слоёв: правый нижний угол над логотипом карт. */
.layer-status {
  position: absolute;
  right: 12px;
  bottom: 34px;
  z-index: 24;
  width: min(300px, calc(100vw - 24px));
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #dbe3e6;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 35, 45, 0.16);
  font-size: 12px;
}
.layer-status[hidden] { display: none; }
.layer-status h2 {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: #14313a;
}
.layer-status ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.layer-status li { display: flex; align-items: center; gap: 8px; }
.ls-name { flex: 1 1 auto; color: #1f3a40; line-height: 1.25; }
.ls-state { flex: none; color: #6b7f85; white-space: nowrap; }
.ls-state.is-ready { color: #1a7f43; }
.ls-state.is-empty { color: #8a6d1a; }
.ls-state.is-error { color: #b3261e; }
.ls-retry {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #f0c9c5;
  border-radius: 6px;
  background: #fdecea;
  color: #b3261e;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.ls-retry:hover { background: #fbdcd8; }
.ls-retry[hidden] { display: none; }

/* Плашка статуса — компактная. */
.layer-status { padding: 7px 9px; width: min(240px, calc(100vw - 24px)); bottom: 26px; }
.layer-status h2 { margin: 0 0 4px; font-size: 11px; }
.layer-status ul { gap: 3px; }
.layer-status li { gap: 6px; }
.ls-name { font-size: 11px; line-height: 1.2; }
.ls-state { font-size: 10.5px; }
.ls-retry { width: 18px; height: 18px; font-size: 11px; }

/* Шаблоны слоёв. */
.tpl-save { display: flex; gap: 6px; margin: 6px 0; }
.tpl-save input { flex: 1 1 auto; min-height: 32px; }
.tpl-save .btn { flex: none; min-height: 32px; padding: 0 10px; }
.tpl-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tpl-list li { display: flex; align-items: center; gap: 6px; }
.tpl-apply {
  flex: 1 1 auto;
  text-align: left;
  padding: 6px 8px;
  border: 1px solid #dbe6ea;
  border-radius: 8px;
  background: #f4f9fb;
  font-size: 12px;
  color: #14313a;
  cursor: pointer;
}
.tpl-apply:hover { background: #e8f2f7; }
.tpl-remove {
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #efd3cf;
  border-radius: 7px;
  background: #fdf1ef;
  color: #a23a2c;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

/* Руководство на весь экран. */
.help-open { width: 100%; margin: 8px 0 10px; }
.help-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 25, 35, 0.45);
}
.help-dialog[hidden] { display: none; }
.help-card {
  width: min(1020px, calc(100vw - 40px));
  height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 22px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(10, 25, 35, 0.3);
}
.help-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.help-head h2 { margin: 0; font-size: 20px; color: #14313a; }
.help-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #eef2f4;
  color: #3d545c;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.help-close:hover { background: #e2e9ec; }
#helpSearch { min-height: 40px; }
.help-list {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}
.help-item { padding: 12px 14px; background: #f6f9fa; border-radius: 10px; }
.help-item h3 { margin: 0 0 6px; font-size: 14px; color: #14313a; }
.help-item p { margin: 0; color: #43606a; font-size: 13px; line-height: 1.5; }
.help-empty { color: #6b7f85; font-size: 13px; }

/* Источники: формы строчками без времени. */
.sync-title { margin-top: 6px; color: #43606a; font-size: 12px; }
.sync-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: #1f3a40; }

/* Активный шаблон подсвечивается, кнопка снятия слоёв — отдельной строкой. */
.tpl-apply.tpl-active {
  background: #e8f6ee;
  border-color: #8fce9f;
  color: #14683a;
  font-weight: 600;
}
.tpl-clear { width: 100%; margin-top: 8px; padding: 8px 10px; font-size: 12px; }

/* Раздел шаблонов стоит отдельно от «Слоёв НСПД» — оформляем как остальные. */
#sec-layers > details.gvr-sub > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  font-size: 13.5px;
  font-weight: 600;
  color: #1f6f8b;
  cursor: pointer;
  list-style: none;
}
#sec-layers > details.gvr-sub > summary::-webkit-details-marker { display: none; }
#sec-layers > details.gvr-sub > summary::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 1px solid #d6e4ea;
  border-radius: 5px;
  background: #f2f8fa url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M6 3.5 10.5 8 6 12.5' fill='none' stroke='%231f6f8b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / 10px 10px no-repeat;
  transition: transform 0.18s ease;
  flex: none;
}
#sec-layers > details.gvr-sub[open] > summary::before { transform: rotate(90deg); }

/* Шаблоны: крупные кнопки и форма, которая открывается по «＋». */
.tpl-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 8px; }
.tpl-list li { display: flex; align-items: center; gap: 6px; }
.tpl-apply {
  flex: 1 1 auto;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid #cfe0e8;
  border-radius: 10px;
  background: #f4f9fb;
  font-size: 13px;
  text-align: left;
  color: #14313a;
  cursor: pointer;
}
.tpl-apply:hover { background: #e8f2f7; }
.tpl-remove {
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid #efd3cf;
  border-radius: 9px;
  background: #fdf1ef;
  color: #a23a2c;
  font-size: 15px;
  cursor: pointer;
}
.tpl-add {
  width: 100%;
  min-height: 38px;
  margin: 2px 0 6px;
  border: 1px dashed #a9c6d3;
  border-radius: 10px;
  background: #fbfdfe;
  color: #1f6f8b;
  font-size: 13px;
  cursor: pointer;
}
.tpl-add:hover { background: #eef6fa; }
.tpl-save { display: flex; gap: 6px; margin: 4px 0 8px; }
.tpl-save input { flex: 1 1 auto; min-height: 38px; }
.tpl-save .btn { flex: none; min-height: 38px; padding: 0 12px; }
.tpl-save[hidden] { display: none; }

/* Управление шаблонами: шестерёнка в заголовке, отметки и порядок. */
.tpl-gear {
  margin-left: auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid #cfe0e8;
  border-radius: 8px;
  background: #f2f8fa;
  color: #1f6f8b;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.tpl-gear:hover { background: #e2eef4; }
.tpl-list li input.tpl-pick { width: 18px; height: 18px; flex: none; }
.tpl-name { flex: 1 1 auto; font-size: 13px; color: #14313a; }
.tpl-move {
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid #dbe6ea;
  border-radius: 8px;
  background: #f7fafb;
  color: #1f6f8b;
  font-size: 13px;
  cursor: pointer;
}
.tpl-actions { display: flex; gap: 6px; margin: 6px 0; }
.tpl-actions .btn { flex: 1 1 auto; min-height: 34px; font-size: 12px; }
.tpl-actions[hidden] { display: none; }

/* История поиска под строкой. */
.search-history { margin-top: 6px; font-size: 12px; }
.search-history[hidden] { display: none; }
.search-history > summary {
  cursor: pointer;
  list-style: none;
  color: #6b7f85;
  padding: 2px 0;
}
.search-history > summary::-webkit-details-marker { display: none; }
.search-history > summary::before { content: "▸ "; }
.search-history[open] > summary::before { content: "▾ "; }
.search-history ul { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.search-history li { display: flex; align-items: center; gap: 4px; }
.hist-apply {
  flex: 1 1 auto;
  text-align: left;
  padding: 5px 8px;
  border: 1px solid #e2eaee;
  border-radius: 7px;
  background: #f8fbfc;
  color: #1f3a40;
  font-size: 12px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hist-apply:hover { background: #eef5f8; }
.hist-remove {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #e6ded9;
  border-radius: 6px;
  background: #fbf7f5;
  color: #8a6a55;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

/* История поиска: компактная строка-заголовок, раскрывается по нажатию. */
.search-history { margin-top: 4px; }
.search-history > summary {
  display: inline-block;
  padding: 1px 0;
  font-size: 11px;
  color: #7c8f96;
  cursor: pointer;
}
.search-history[open] > summary { color: #1f6f8b; }

/* Строка поиска шире: кнопка компактнее, поле получает больше места. */
#sec-search .search-row .btn { padding: 0 12px; font-size: 13px; }
#sec-search .search-field input { font-size: 12.5px; }

/* Поле поиска растёт по высоте: длинный адрес виден целиком, а не обрезается. */
#sec-search .search-field { display: flex; align-items: stretch; }
#sec-search #unified-query {
  flex: 1 1 auto;
  width: 100%;
  min-height: 38px;
  max-height: 104px;
  padding: 9px 32px 9px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--ui-field, #eef1f3);
  color: var(--ui-text, #1f2937);
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.35;
  resize: none;
  overflow-y: auto;
}
#sec-search #unified-query:focus { outline: 2px solid var(--ui-accent, #0b6bcb); outline-offset: -2px; }
#sec-search .search-clear { top: 9px; transform: none; }

/* Поле поиска: подсказка видна целиком, без обрезки и полосы прокрутки. */
#sec-search #unified-query {
  min-height: 52px;
  max-height: 108px;
  padding: 8px 32px 8px 12px;
  line-height: 1.35;
  overflow-y: hidden;
  scrollbar-width: none;
}
#sec-search #unified-query::-webkit-scrollbar { width: 0; height: 0; }
#sec-search #unified-query::placeholder { color: #8397a0; opacity: 1; }
