/* ==========================================================================
   RTcomFlyers — минималистичный интерфейс
   ========================================================================== */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f1f3f6;
  --line: #e6e9ee;
  --line-strong: #d5dae1;
  --text: #14171c;
  --text-2: #495057;
  --muted: #7b8794;
  --accent: #2f6df6;
  --accent-hover: #2359da;
  --accent-soft: #eaf0fe;
  --ok: #12894a;
  --ok-soft: #e7f6ed;
  --warn: #b96a06;
  --warn-soft: #fdf3e2;
  --danger: #d0342c;
  --danger-soft: #fdebeb;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 30px rgba(16, 24, 40, .08);
  --sidebar: 264px;
  --panel: 396px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d8dde4; border: 3px solid transparent; background-clip: content-box; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #c3cad3; background-clip: content-box; }

.ic { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.fill { fill: currentColor; stroke: none; }

/* --- Иконки и утилиты ----------------------------------------------------- */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.micro { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 14px; } .mt-4 { margin-top: 22px; }
.gap-2 { gap: 8px; } .gap-3 { gap: 14px; }
.center { display: flex; align-items: center; justify-content: center; }

/* --- Загрузка ------------------------------------------------------------- */
.boot { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.boot-mark { animation: pulse 1.8s ease-in-out infinite; }
.boot-text { color: var(--muted); font-size: 14px; }
@keyframes pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

.noscript { padding: 24px; text-align: center; }

/* --- Кнопки --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 550; cursor: pointer;
  transition: background .14s ease, border-color .14s ease, color .14s ease, opacity .14s ease;
  white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { color: var(--danger); border-color: #f0cfcd; background: var(--danger-soft); }
.btn.danger:hover { background: #fbdcdb; }
.btn.ok { color: #fff; background: var(--ok); border-color: var(--ok); }
.btn.ok:hover { background: #0d733e; border-color: #0d733e; }
.btn.block { width: 100%; }
.btn.sm { height: 34px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 34px; }
.btn.fab { height: 52px; padding: 0 20px; border-radius: 26px; box-shadow: var(--shadow); font-size: 15px; }

/* --- Формы ---------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 550; color: var(--text-2); }
.hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 14px;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.textarea { height: auto; min-height: 78px; padding: 10px 12px; resize: vertical; line-height: 1.4; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: #a8b1bb; }
.input[type="color"] { padding: 4px; width: 52px; cursor: pointer; }
.select { appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237b8794' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

/* --- Экран авторизации ---------------------------------------------------- */
.auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(900px 460px at 12% -8%, #e8efff 0%, rgba(232, 239, 255, 0) 62%),
    radial-gradient(760px 420px at 95% 8%, #e9f6f1 0%, rgba(233, 246, 241, 0) 58%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 412px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  padding: 26px 26px 22px;
}
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 4px; }
.auth-brand .name { font-size: 19px; font-weight: 650; letter-spacing: -.2px; }
.auth-brand .name em { font-style: normal; color: var(--accent); }
.auth-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 20px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 10px; margin-bottom: 18px; }
.tabs button {
  flex: 1; height: 34px; border: 0; border-radius: 7px; background: transparent;
  font-size: 14px; font-weight: 550; color: var(--text-2); cursor: pointer; transition: all .14s ease;
}
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.form-grid { display: flex; flex-direction: column; gap: 14px; }
.form-error {
  background: var(--danger-soft); color: var(--danger); border: 1px solid #f3d3d1;
  padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px;
}
.auth-note { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; display: flex; gap: 8px; }

/* --- Каркас приложения ---------------------------------------------------- */
.app { height: 100vh; }
.shell {
  display: grid; height: 100vh; min-height: 0;
  grid-template-columns: var(--sidebar) 1fr;
  grid-template-areas: "sidebar workspace";
}

.sidebar {
  grid-area: sidebar; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand .logo { width: 30px; height: 30px; }
.brand .name { font-size: 16px; font-weight: 650; letter-spacing: -.2px; }
.brand .name em { font-style: normal; color: var(--accent); }
.brand .sub { font-size: 11.5px; color: var(--muted); margin-top: -2px; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 11px;
  border: 0; border-radius: 9px; background: transparent; color: var(--text-2);
  font-size: 14px; font-weight: 500; cursor: pointer; text-align: left; width: 100%;
  transition: background .14s ease, color .14s ease;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .count {
  margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--muted);
  background: var(--surface-3); border-radius: 20px; padding: 1px 7px;
}
.nav-item.active .count { background: #fff; color: var(--accent); }
.nav-sep { height: 1px; background: var(--line); margin: 10px 18px; }
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); }

.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.user-card:hover { background: var(--surface-3); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 650; font-size: 13.5px;
}
.avatar.admin { background: #f1ecfe; color: #6d4bd8; }
.role-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 1px 8px; border-radius: 20px; background: var(--surface-3); color: var(--text-2);
}
.role-badge.admin { background: #f1ecfe; color: #6d4bd8; }

.workspace { grid-area: workspace; display: flex; min-width: 0; min-height: 0; }
.map-wrap { position: relative; flex: 1; min-width: 0; background: #e9edf2; }
.map-canvas { position: absolute; inset: 0; }
.map-fallback { display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center;
  height: 100%; color: var(--muted); text-align: center; padding: 24px; }

.map-top {
  position: absolute; z-index: 500; top: 14px; left: 14px; right: 14px;
  display: flex; align-items: flex-start; gap: 10px; pointer-events: none; flex-wrap: wrap;
}
.map-top > * { pointer-events: auto; }
.map-tools { position: absolute; z-index: 500; right: 14px; bottom: 22px; display: flex; flex-direction: column; gap: 8px; }
.map-btn {
  width: 42px; height: 42px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow); color: var(--text-2);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.map-btn:hover { color: var(--accent); }
.map-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.legend {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-sm); padding: 8px 11px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2);
}
.legend .key { display: flex; align-items: center; gap: 6px; }
.legend .swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.legend .swatch.dot { border-radius: 50%; }

.map-chip {
  display: inline-flex; align-items: center; gap: 7px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-sm);
  padding: 7px 11px; font-size: 13px; color: var(--text-2);
}
.map-chip.warn { color: var(--warn); border-color: #f0dcbd; background: var(--warn-soft); }
.map-chip.live { color: #0f7a44; border-color: #cbead8; background: var(--ok-soft); font-weight: 600; }

/* --- Подписи участков на карте ------------------------------------------- */
.zone-label-host { background: none; border: 0; }
.zone-label {
  position: absolute; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px 2px 7px; border-radius: 20px;
  background: rgba(255, 255, 255, .95); border: 1px solid var(--line-strong);
  font-size: 11.5px; font-weight: 600; color: var(--text); white-space: nowrap;
  box-shadow: 0 1px 4px rgba(16, 24, 40, .18); cursor: pointer;
}
.zone-label.dim { opacity: .75; }
.zone-label i { width: 7px; height: 7px; border-radius: 50%; flex: none; }

/* --- Смена и хранилище ---------------------------------------------------- */
.live-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none;
  box-shadow: 0 0 0 0 rgba(18, 137, 74, .55); animation: pulse-live 1.9s infinite;
}
@keyframes pulse-live {
  0% { box-shadow: 0 0 0 0 rgba(18, 137, 74, .5); }
  70% { box-shadow: 0 0 0 9px rgba(18, 137, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(18, 137, 74, 0); }
}
.work-card.active { border-color: #bfe6d0; background: linear-gradient(180deg, #f4fbf7 0%, #ffffff 60%); }
.work-card .btn.ok { height: 44px; font-size: 15px; }
.storage { padding-top: 10px; border-top: 1px solid var(--line); margin-top: 12px; }
.map-btn.work.active { background: var(--ok); border-color: var(--ok); color: #fff; }

/* --- Панель --------------------------------------------------------------- */
.panel {
  width: var(--panel); flex: none; background: var(--surface); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.panel-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.panel-title { font-size: 17px; font-weight: 650; letter-spacing: -.2px; }
.panel-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.panel-body { padding: 14px 14px 24px; overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.panel-foot { padding: 12px 14px; border-top: 1px solid var(--line); background: var(--surface); }

/* --- Карточки и списки ---------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px; box-shadow: var(--shadow-sm);
}
.card.flat { box-shadow: none; }
.card.clickable { cursor: pointer; transition: border-color .14s ease, box-shadow .14s ease; }
.card.clickable:hover { border-color: var(--line-strong); box-shadow: 0 4px 14px rgba(16, 24, 40, .07); }
.card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.card-title { font-size: 14.5px; font-weight: 600; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.card-meta span { display: inline-flex; align-items: center; gap: 5px; }

.zone-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.progress { height: 5px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .25s ease; }
.progress.ok > i { background: var(--ok); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 30px; padding: 0 12px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text-2); font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { background: var(--surface-3); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.stat {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 12px; background: var(--surface-2);
}
.stat .v { font-size: 21px; font-weight: 650; letter-spacing: -.4px; line-height: 1.15; }
.stat .k { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat.accent { background: var(--accent-soft); border-color: #d7e2fd; }
.stat.accent .v { color: var(--accent); }
.stat.warn { background: var(--warn-soft); border-color: #f0dcbd; }
.stat.warn .v { color: var(--warn); }

.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty .ic { color: #c4ccd6; margin-bottom: 10px; }
.empty h4 { font-size: 14.5px; color: var(--text-2); font-weight: 600; margin-bottom: 4px; }
.empty p { font-size: 13px; max-width: 260px; margin: 0 auto; }

/* --- Галерея фото --------------------------------------------------------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photo-card {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface);
  cursor: pointer; transition: box-shadow .14s ease, border-color .14s ease; position: relative;
}
.photo-card:hover { box-shadow: 0 6px 18px rgba(16, 24, 40, .1); border-color: var(--line-strong); }
.photo-card .thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--surface-3); }
.photo-card .info { padding: 8px 9px; display: flex; flex-direction: column; gap: 3px; }
.photo-card .stripe { position: absolute; top: 8px; left: 8px; }
.photo-card .geo {
  position: absolute; top: 8px; right: 8px; background: rgba(20, 23, 28, .72); color: #fff;
  border-radius: 20px; padding: 2px 8px; font-size: 11px; display: flex; align-items: center; gap: 4px; backdrop-filter: blur(3px);
}
.photo-card .geo.out { background: rgba(208, 52, 44, .85); }
.photo-view img { width: 100%; border-radius: 10px; display: block; background: var(--surface-3); }
.meta-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; }

/* --- Модальные окна ------------------------------------------------------- */
.modal-root { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(16, 24, 40, .42); backdrop-filter: blur(2px); animation: fade .16s ease; }
.modal {
  position: relative; width: 100%; max-width: 520px; max-height: calc(100vh - 36px);
  background: var(--surface); border-radius: 16px; box-shadow: 0 24px 60px rgba(16, 24, 40, .24);
  display: flex; flex-direction: column; overflow: hidden; animation: pop .17s ease;
}
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16.5px; font-weight: 650; letter-spacing: -.2px; }
.modal-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-end; background: var(--surface-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } }

.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 18px;
  text-align: center; color: var(--muted); background: var(--surface-2); cursor: pointer; transition: all .14s ease;
}
.dropzone:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.preview { width: 100%; max-height: 290px; object-fit: contain; border-radius: var(--radius); background: var(--surface-3); }

.geo-line {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; color: var(--text-2);
}
.geo-line.ok { background: var(--ok-soft); border-color: #cbead8; color: var(--ok); }
.geo-line.warn { background: var(--warn-soft); border-color: #f0dcbd; color: var(--warn); }
.geo-line.danger { background: var(--danger-soft); border-color: #f3d3d1; color: var(--danger); }

/* --- Тосты ---------------------------------------------------------------- */
.toasts { position: fixed; z-index: 4000; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 9px; background: #1c2027; color: #fff;
  padding: 10px 15px; border-radius: 11px; font-size: 13.5px; box-shadow: 0 10px 26px rgba(16, 24, 40, .28);
  animation: pop .18s ease; max-width: min(92vw, 460px);
}
.toast.ok { background: #146c43; }
.toast.err { background: #a52922; }
.toast.warn { background: #8a5308; }

/* --- Режим рисования ------------------------------------------------------ */
.draw-hint {
  position: fixed; z-index: 2500; top: 60px; left: 50%; transform: translateX(-50%);
  background: #1c2027; color: #fff; border-radius: 12px; padding: 10px 14px;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 12px 30px rgba(16, 24, 40, .3); font-size: 13.5px;
  max-width: min(94vw, 640px); flex-wrap: wrap; justify-content: center;
}
.draw-hint .ic { color: #9db8fb; }
.draw-hint .btn { height: 32px; }
.draw-hint .btn.ghost { color: #d7dbe2; }
.draw-hint .btn.ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.draw-hint .btn.primary { background: var(--accent); border-color: var(--accent); }
.crosshair { cursor: crosshair !important; }

/* --- Нижняя навигация (мобильные) ---------------------------------------- */
.tabbar { grid-area: tabbar; display: none; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
.tabbar-item {
  flex: 1; border: 0; background: transparent; color: var(--muted); font-size: 11px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; cursor: pointer; border-radius: 10px;
}
.tabbar-item.active { color: var(--accent); }
.tabbar-item .ic { width: 22px; height: 22px; }
.tabbar-item .dotmark { position: absolute; }

/* --- Плашка «карта недоступна» ------------------------------------------- */
.map-error {
  position: absolute; inset: auto 14px 14px; z-index: 600; background: var(--danger-soft);
  border: 1px solid #f3d3d1; color: var(--danger); border-radius: var(--radius); padding: 10px 13px; font-size: 13px;
}

/* --- Адаптив -------------------------------------------------------------- */
@media (max-width: 1180px) { :root { --panel: 340px; } }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto; grid-template-areas: "workspace" "tabbar"; }
  .sidebar { display: none; }
  .tabbar { display: flex; }
  .workspace { flex-direction: column; }
  .map-wrap { height: 44vh; min-height: 260px; }
  .panel { width: auto; flex: 1; border-left: 0; border-top: 1px solid var(--line); }
  .panel-head { padding: 13px 15px 10px; }
  .panel-body { padding: 12px 12px 20px; }
  .map-top { top: 10px; left: 10px; right: 10px; }
  .modal-root { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 16px 16px 0 0; max-height: 92vh; }
  .modal-foot { padding-bottom: calc(13px + env(safe-area-inset-bottom)); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .draw-hint { top: 8px; }
}

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 8px; }
  .map-top .legend { display: none; }
  .map-chip.warn .warn-label { display: none; }
  .map-chip { padding: 5px 9px; font-size: 12px; }
  .draw-hint { top: 8px; font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
