/* ═══════════════════════════════════════════════════════════
   PORUCH TACTIC — light command-center theme
   Чистая светлая тема: белые панели, мягкие тени, синий акцент.
   Имена переменных сохранены (на них завязаны inline-стили и app.js).
   ═══════════════════════════════════════════════════════════ */
:root {
  --bg:      #eef1f6;   /* канва приложения */
  --bg-2:    #f5f7fb;   /* инпуты, rail, мягкие заливки */
  --panel:   #ffffff;   /* сайдбар, модалки */
  --panel-2: #f8fafc;   /* карточки */
  --surface: #ffffff;
  --line:    #e9edf3;   /* волоски-разделители */
  --line-2:  #d7deea;   /* заметные бордеры */

  --cyan:    #2563eb;   /* ПЕРВИЧНЫЙ акцент (синий) */
  --cyan-15: rgba(37,99,235,.12);
  --cyan-25: rgba(37,99,235,.20);
  --magenta: #d6409f;
  --lime:    #15a34a;   /* успех / онлайн */
  --lime-15: rgba(21,163,74,.12);
  --amber:   #d97706;   /* предупреждение */
  --amber-15:rgba(217,119,6,.13);
  --red:     #e11d48;   /* опасность / SOS */
  --red-15:  rgba(225,29,72,.12);

  --text:    #1b2432;
  --muted:   #74829a;
  --accent:  var(--cyan);
  --ok:      var(--lime);
  --danger:  var(--red);

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, monospace;

  --ring:    0 0 0 3px rgba(37,99,235,.18);      /* focus-ring */
  --glow-cyan: var(--ring);                       /* legacy alias (focus box-shadow) */
  --sh-sm:   0 1px 2px rgba(16,24,40,.06);
  --sh-md:   0 4px 14px rgba(16,24,40,.08);
  --sh-lg:   0 12px 34px rgba(16,24,40,.14);
  --glow-soft: var(--sh-md);                      /* legacy alias */
  --radius:  10px;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cdd6e3; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #b6c2d4; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.error { color: var(--danger); margin-top: 8px; font-size: 13px; }
.mono { font-family: var(--mono); }

button { font-family: inherit; transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .08s ease; }
button:active:not(:disabled) { transform: translateY(1px); }
a { color: var(--cyan); }

/* ── LOGIN ── */
.login-screen {
  height: 100%; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 520px at 25% 15%, rgba(37,99,235,.10), transparent 60%),
    radial-gradient(760px 520px at 85% 95%, rgba(214,64,159,.08), transparent 60%),
    var(--bg);
}
.login-box {
  background: var(--panel);
  padding: 36px 34px; border-radius: 18px; width: 350px;
  display: flex; flex-direction: column; gap: 13px;
  border: 1px solid var(--line);
  box-shadow: var(--sh-lg);
  animation: pop .3s cubic-bezier(.2,.8,.25,1);
}
.login-box h1 {
  margin: 0; font-size: 25px; letter-spacing: .3px; color: var(--text);
}
.login-box .muted { margin: -4px 0 6px; }
.login-box input {
  padding: 12px 13px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--bg-2); color: var(--text); font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.login-box input:focus { outline: none; border-color: var(--cyan); box-shadow: var(--ring); background: #fff; }
.login-box button {
  padding: 12px; border-radius: 10px; border: none; margin-top: 4px;
  background: var(--cyan); color: #fff; cursor: pointer;
  font-weight: 700; letter-spacing: .4px; font-size: 14px;
  box-shadow: 0 4px 12px rgba(37,99,235,.30);
}
.login-box button:hover { background: #1d4fd8; box-shadow: 0 6px 18px rgba(37,99,235,.40); }

/* ── LAYOUT ── */
.layout { display: flex; height: 100%; }
.map-zone { position: relative; flex: 1; }
#map { position: absolute; inset: 0; background: #e5e9f0; }

/* светлая карта — без тонировки; лёгкая виньетка сверху */
.leaflet-tile-pane { filter: saturate(1.02); }
.map-zone::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 401;
  background: radial-gradient(130% 100% at 50% 40%, transparent 72%, rgba(27,36,50,.06));
}
.leaflet-container { background: #e5e9f0; font: inherit; }
.leaflet-control-zoom a {
  background: #fff !important; color: var(--cyan) !important;
  border-color: var(--line-2) !important; transition: background .15s;
}
.leaflet-control-zoom a:hover { background: var(--bg-2) !important; }
.leaflet-bar { box-shadow: var(--sh-md) !important; border: none !important; border-radius: 10px !important; overflow: hidden; }
.leaflet-control-attribution {
  background: rgba(255,255,255,.82) !important; color: var(--muted) !important;
  backdrop-filter: blur(4px);
}
.leaflet-control-attribution a { color: var(--cyan) !important; }

/* ── SIDEBAR ── */
.sidebar {
  width: 360px; background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column; height: 100%;
  transition: width .22s cubic-bezier(.4,0,.2,1); overflow: hidden;
  box-shadow: -8px 0 30px rgba(16,24,40,.06);
}
.sidebar.hidden { width: 0; border-left: none; }

.sidebar-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 15px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fafcff, #fff);
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand .logo { color: var(--cyan); font-size: 17px; }
.brand b { letter-spacing: 1.2px; font-size: 13px; text-transform: uppercase; color: var(--text); }
.sidebar-head span { display: flex; align-items: center; gap: 8px; }
.link { background: none; border: none; color: var(--muted); cursor: pointer; text-decoration: none; font-size: 13px; padding: 2px 4px; border-radius: 6px; transition: .15s; }
.link:hover { color: var(--cyan); background: var(--cyan-15); }

/* статус-пилюли в шапке */
.head-pills { display: flex; gap: 6px; padding: 9px 15px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pill {
  font-family: var(--mono); font-size: 11px; padding: 3px 10px; border-radius: 20px;
  border: 1px solid var(--line-2); color: var(--muted); background: var(--bg-2);
  display: flex; align-items: center; gap: 5px;
}
.pill b { color: var(--text); }
.pill.on { border-color: rgba(21,163,74,.35); color: var(--lime); background: var(--lime-15); }
.pill.sos { border-color: rgba(225,29,72,.4); color: var(--red); background: var(--red-15); }
.pill.coord { border-color: rgba(217,119,6,.4); color: var(--amber); background: var(--amber-15); }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ── TABS (legacy) ── */
.tabs { display: flex; flex-wrap: wrap; padding: 8px 8px 0; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button {
  flex: 1 0 auto; min-width: 58px; padding: 8px; background: var(--bg-2);
  border: 1px solid var(--line); border-bottom: none; color: var(--muted);
  cursor: pointer; font-size: 11px; border-radius: 8px 8px 0 0; transition: .15s;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabs button .ti { font-size: 15px; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--cyan); border-color: var(--line-2); background: #fff; box-shadow: inset 0 -2px 0 var(--cyan); }
.badge { background: var(--red); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 10px; position: absolute; transform: translate(14px,-6px); }

.tab-body { padding: 13px 15px; overflow-y: auto; flex: 1; scroll-behavior: smooth; }
.tab-body > * { animation: fadein .22s ease; }

/* ── icon-rail + розділи ── */
.sidebar-body { display: flex; flex: 1; min-height: 0; }
.rail { width: 60px; flex: none; position: relative; display: flex; flex-direction: column; background: linear-gradient(180deg, #f7f9fc, #eef2f8); border-right: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; }
.rail::-webkit-scrollbar { width: 0; }
/* скользящий индикатор активного раздела */
.rail-indicator {
  position: absolute; top: 4px; left: 7px; right: 7px; height: 44px; z-index: 0;
  border-radius: 13px;
  background: linear-gradient(160deg, #3f78f5, #2158e0);
  box-shadow: 0 6px 15px rgba(33,88,224,.4), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .36s cubic-bezier(.34,1.35,.5,1);
}
.rail button { height: 52px; flex: none; background: none; border: none; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 9px; position: relative; z-index: 1; transition: color .2s ease; }
.rail button .ri { font-size: 17px; line-height: 1; transition: transform .28s cubic-bezier(.34,1.5,.5,1); filter: drop-shadow(0 1px 1px rgba(16,24,40,.15)); }
.rail button .rl { opacity: .95; transition: color .2s; }
.rail button::before { content: ""; position: absolute; inset: 4px 7px; border-radius: 13px; background: rgba(37,99,235,.09); opacity: 0; transform: scale(.85); transition: opacity .18s, transform .18s; z-index: -1; }
.rail button:not(.active):hover::before { opacity: 1; transform: scale(1); }
.rail button:not(.active):hover { color: var(--cyan); }
.rail button:not(.active):hover .ri { transform: translateY(-2px); }
.rail button.active { color: #fff; }
.rail button.active .rl { color: #fff; font-weight: 700; letter-spacing: .2px; }
.rail button.active .ri { transform: scale(1.18); filter: drop-shadow(0 3px 5px rgba(0,0,0,.28)); }
.rbadge { position: absolute; top: 5px; right: 9px; background: var(--red); color: #fff; border-radius: 9px; font-size: 9px; padding: 0 5px; box-shadow: 0 2px 6px rgba(225,29,72,.5); z-index: 2; }
.section { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
/* сегментед-контрол зі скользящою пілюлею */
.subtabs { position: relative; display: flex; gap: 4px; margin: 11px 12px; padding: 4px; background: linear-gradient(180deg, #eef2f8, #e7ecf4); border: 1px solid var(--line); border-radius: 13px; box-shadow: inset 0 1px 2px rgba(16,24,40,.05); overflow-x: auto; scrollbar-width: none; }
.subtabs::-webkit-scrollbar { height: 0; }
.subtab-indicator { display: none; }
.subtabs button { flex: 0 0 auto; white-space: nowrap; background: none; border: none; color: var(--muted); padding: 8px 13px; cursor: pointer; font-size: 12.5px; font-weight: 600; position: relative; z-index: 1; transition: color .18s, background .18s; border-radius: 10px; }
.subtabs button:hover:not(.active) { color: var(--text); }
.subtabs button.active { color: var(--cyan); background: #fff; box-shadow: 0 2px 8px rgba(16,24,40,.12), 0 0 0 1px rgba(16,24,40,.02); }
.subtabs .badge { transform: translate(2px,-9px); }
h4 { margin: 17px 0 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 700; }

/* ── SOS BANNER ── */
.sos-banner {
  margin: 9px; border: 1px solid rgba(225,29,72,.45); border-radius: 12px; overflow: hidden;
  background: #fff; box-shadow: 0 4px 16px rgba(225,29,72,.16); animation: sosglow 1.6s ease-in-out infinite;
}
@keyframes sosglow { 50% { box-shadow: 0 4px 22px rgba(225,29,72,.34); } }
.sos-banner-head { background: var(--red-15); color: var(--red); font-weight: 700; padding: 7px 11px; letter-spacing: .6px; font-size: 12px; }
.sos-row { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-top: 1px solid var(--red-15); }
.sos-row .nm { flex: 1; }
.sos-row .t { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* координация — янтарный вариант баннера */
.coord-banner { border-color: rgba(217,119,6,.45); box-shadow: 0 4px 16px rgba(217,119,6,.14); animation: none; }
.coord-banner .sos-banner-head { background: var(--amber-15); color: var(--amber); }
.coord-banner .sos-row { border-top-color: var(--amber-15); }
.log-item.coord { background: var(--amber-15); border-radius: 8px; padding: 7px 9px; }
.log-item.coord .log-dir { color: var(--amber); }

/* ── AVATAR ── */
.avatar {
  width: 32px; height: 32px; border-radius: 10px; flex: none; display: flex;
  align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
  color: #fff; position: relative; font-family: var(--mono);
  box-shadow: var(--sh-sm); text-shadow: 0 1px 1px rgba(0,0,0,.25);
}
.avatar.off { filter: grayscale(.65) opacity(.6); }
.avatar .pr { position: absolute; right: -3px; bottom: -3px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; }
.pr.available { background: var(--lime); }
.pr.busy { background: var(--amber); }
.pr.break { background: var(--muted); }

/* ── REQUESTS ── */
.req-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; transition: box-shadow .15s, border-color .15s; }
.req-card:hover { box-shadow: var(--sh-md); border-color: var(--line-2); }
.req-name { font-weight: 600; }
.req-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ── BUTTONS ── */
button.ok, button.danger, button.neon {
  border: 1px solid transparent; border-radius: 9px; padding: 8px 14px; cursor: pointer; font-size: 12.5px; font-weight: 600;
}
button.ok { background: var(--lime); color: #fff; box-shadow: 0 2px 6px rgba(21,163,74,.22); }
button.ok:hover { background: #128a3f; box-shadow: 0 4px 12px rgba(21,163,74,.3); }
button.danger { background: #fff; color: var(--red); border-color: rgba(225,29,72,.45); }
button.danger:hover { background: var(--red-15); }
button.neon { background: var(--cyan); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.25); }
button.neon:hover { background: #1d4fd8; box-shadow: 0 4px 14px rgba(37,99,235,.35); }
button.neon.active { background: #1740b0; box-shadow: inset 0 2px 6px rgba(0,0,0,.2); }
button.wide { width: 100%; margin-top: 7px; }
button:disabled { opacity: .45; cursor: default; box-shadow: none; }
.icon-btn {
  background: #fff; border: 1px solid var(--line-2); color: var(--text);
  border-radius: 8px; cursor: pointer; padding: 5px 9px; font-size: 13px; flex: none;
  transition: .14s;
}
.icon-btn:hover { border-color: var(--cyan); color: var(--cyan); background: var(--cyan-15); }
.icon-btn.active { background: var(--cyan-15); border-color: var(--cyan); color: var(--cyan); }
.icon-btn.mini { padding: 3px 7px; font-size: 11px; }

/* ── INPUTS ── */
.search, .fld select, textarea, .create-row input, .create-row select, .inline-name, .convo-input input,
input[type=text], input[type=password], input[type=number], input[type=datetime-local], select {
  width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--bg-2); color: var(--text); font-size: 13px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search { margin-bottom: 10px; }
textarea { margin-bottom: 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: var(--ring); background: #fff; }
.fld { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; font-weight: 600; }
.fld select { margin-top: 4px; }
input[type=color] { cursor: pointer; }

/* ── LIST ── */
.list-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 8px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 9px; transition: background .13s; }
.list-row:hover { background: var(--bg-2); }
.list-row .sel-chk, .list-row > .avatar { margin-top: 2px; }
.list-main { flex: 1; min-width: 0; cursor: pointer; }
.list-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-tags { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.list-acts { display: flex; gap: 2px; align-self: flex-start; flex: none; }
.list-acts .icon-btn { border-color: transparent; background: transparent; padding: 5px 6px; font-size: 14px; box-shadow: none; }
.list-acts .icon-btn:hover { background: var(--bg-2); border-color: transparent; }
.list-acts .icon-btn.danger-icon:hover { background: var(--red-15); color: var(--red); }
.list-row select { margin: 6px 0 0; width: 100%; padding: 5px 8px; font-size: 12px; border-radius: 7px; }
.tag { font-size: 10px; padding: 1px 8px; border-radius: 8px; font-family: var(--mono); font-weight: 600; white-space: nowrap; }
.grp-tag { color: #fff; font-weight: 700; text-shadow: 0 1px 1px rgba(0,0,0,.2); }
.pr-tag { border: 1px solid var(--line-2); color: var(--muted); background: var(--bg-2); }
.pr-tag.available { color: var(--lime); border-color: rgba(21,163,74,.35); background: var(--lime-15); }
.pr-tag.busy { color: var(--amber); border-color: rgba(217,119,6,.35); background: var(--amber-15); }
.pr-tag.break { color: var(--muted); }
.role-chip { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex: none; vertical-align: middle; box-shadow: 0 0 0 1px rgba(0,0,0,.06); }

/* ── GROUPS / SECTORS / POI cards ── */
.create-row { display: flex; gap: 6px; margin-bottom: 10px; align-items: center; }
.create-row input[type=color] { width: 38px; height: 38px; padding: 0; border-radius: 9px; border: 1px solid var(--line-2); background: #fff; flex: none; }
.create-row .ok, .create-row .neon { padding: 8px 13px; }
.grp-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; transition: box-shadow .15s, border-color .15s; }
.grp-card:hover { box-shadow: var(--sh-sm); }
.grp-head { display: flex; align-items: center; gap: 7px; }
.grp-actions { margin-left: auto; display: flex; gap: 4px; }
.grp-member { display: flex; align-items: center; gap: 7px; padding: 6px 0; font-size: 13px; border-top: 1px solid var(--line); }
.grp-member .icon-btn.mini { margin-left: auto; }
.leader-star { color: var(--amber); }
.inline-name { flex: 1; }
.sector-stat { font-size: 13px; margin: 7px 0; font-family: var(--mono); }
.poi-kind-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.poi-kind-pick button { flex: 1 0 28%; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.emoji-btn { border: 1px solid var(--line); background: var(--bg-2); border-radius: 9px; font-size: 17px; line-height: 1; padding: 6px 0; cursor: pointer; transition: .12s; }
.emoji-btn:hover { border-color: var(--cyan); background: var(--cyan-15); transform: translateY(-1px); }
.emoji-btn.active { border-color: var(--cyan); background: var(--cyan-15); box-shadow: var(--ring); }
.emoji-cur { flex: none; width: 40px; height: 40px; border: 1px solid var(--line-2); background: #fff; border-radius: 10px; font-size: 20px; line-height: 1; cursor: pointer; transition: .12s; }
.emoji-cur:hover { border-color: var(--cyan); background: var(--cyan-15); }
.poi-coords { display: flex; gap: 8px; margin-top: 8px; }
.poi-coords label { flex: 1; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.poi-coords input { width: 100%; padding: 5px 7px; font-size: 12px; margin-top: 2px; font-family: var(--mono); }

/* ── FILTERS PANEL ── */
.filters-panel {
  position: absolute; top: 14px; left: 14px; z-index: 500;
  background: rgba(255,255,255,.94); border: 1px solid var(--line-2);
  border-radius: 13px; padding: 11px 13px; max-width: 240px;
  backdrop-filter: blur(8px); box-shadow: var(--sh-md);
}
.fp-head { display: flex; align-items: center; gap: 6px; }
.fp-head .counter { flex: 1; margin: 0; }
.counter { font-size: 13px; font-family: var(--mono); }
.counter b { color: var(--cyan); }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); margin-right: 5px; box-shadow: 0 0 0 3px rgba(21,163,74,.18); }
.chk { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 3px 0; cursor: pointer; }
.chk input { accent-color: var(--cyan); }
.role-filters { margin-top: 7px; border-top: 1px solid var(--line); padding-top: 7px; }

/* плавающие кнопки на карте */
.map-tools { position: absolute; left: 12px; bottom: 16px; z-index: 500; display: flex; flex-direction: column; gap: 6px; }
.map-tools button { box-shadow: var(--sh-sm); background: #fff; width: 32px; height: 32px; border-radius: 9px; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.sidebar-reopen { position: absolute; top: 14px; right: 14px; z-index: 600; box-shadow: var(--sh-md); background: #fff; width: 40px; height: 40px; border-radius: 11px; font-size: 17px; }
.map-search {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 500;
}
.map-search input {
  width: 250px; padding: 9px 14px; border-radius: 22px; border: 1px solid var(--line-2);
  background: rgba(255,255,255,.94); color: var(--text); backdrop-filter: blur(8px); box-shadow: var(--sh-md);
}
.map-search input:focus { background: #fff; }
.replay-panel {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 600;
  display: flex; align-items: center; gap: 9px; width: min(560px, 80vw);
  background: rgba(255,255,255,.97); border: 1px solid var(--line-2); border-radius: 14px; padding: 9px 13px; box-shadow: var(--sh-lg);
}
.replay-panel input[type=range] { accent-color: var(--cyan); }
.replay-panel .rsel { width: auto; padding: 5px 7px; }
.tmpl-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { background: var(--cyan-15); border: 1px solid transparent; color: var(--cyan); border-radius: 15px; padding: 5px 12px; cursor: pointer; font-size: 12px; font-weight: 500; transition: .14s; }
.chip:hover { background: var(--cyan-25); }
.tmpl-manage { margin: 10px 0; }
.tmpl-manage summary { cursor: pointer; padding: 5px 0; color: var(--muted); }
.tmpl-manage summary:hover { color: var(--cyan); }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.photo-cell { display: block; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; text-decoration: none; transition: transform .14s, box-shadow .14s; }
.photo-cell:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.photo-cell img { width: 100%; height: 82px; object-fit: cover; display: block; }
.photo-cap { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-size: 10px; color: var(--muted); padding: 3px 6px; background: var(--bg-2); }
.draw-hint {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 600;
  background: var(--cyan); color: #fff; padding: 9px 16px; border-radius: 11px;
  font-size: 13px; box-shadow: var(--sh-lg); animation: pop .25s ease;
}

/* ── NEAREST PANEL ── */
.nearest-panel {
  position: absolute; left: 14px; bottom: 78px; z-index: 600; width: 256px;
  background: rgba(255,255,255,.97); border: 1px solid var(--line-2); border-radius: 13px;
  padding: 11px 13px; box-shadow: var(--sh-lg); animation: pop .22s ease;
}
.nearest-panel h4 { margin: 0 0 8px; color: var(--cyan); }
.near-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.near-row .d { font-family: var(--mono); color: var(--cyan); font-size: 12px; font-weight: 600; }

/* ── STATS (звіти) ── */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 14px; }
.stat-tile { background: linear-gradient(180deg, #ffffff, #f5f8fc); border: 1px solid var(--line); border-radius: 13px; padding: 13px; transition: box-shadow .15s, transform .12s; }
.stat-tile:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.stat-tile .v { font-family: var(--mono); font-size: 26px; font-weight: 700; background: linear-gradient(160deg, #3f78f5, #2158e0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-tile .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }

/* ── LOG ── */
.log-item { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.log-dir { color: var(--muted); }
.log-item.in .log-dir { color: var(--lime); }
.log-meta { display: flex; justify-content: space-between; gap: 8px; }
.log-text { margin-top: 2px; word-break: break-word; }

/* ── POPUP ── */
.leaflet-popup-content-wrapper { background: #fff; color: var(--text); border-radius: 12px; box-shadow: var(--sh-lg); }
.leaflet-popup-tip { background: #fff; box-shadow: var(--sh-lg); }
.leaflet-popup-content { margin: 14px; min-width: 218px; }
.leaflet-popup-close-button { color: var(--muted) !important; }
.popup h3 { margin: 0 0 4px; font-size: 15px; }
.popup .pop-meta { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.popup input, .popup textarea, .popup select { width: 100%; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text); margin-bottom: 6px; font-size: 13px; }
.popup button { border: 1px solid transparent; border-radius: 8px; padding: 7px 11px; cursor: pointer; font-size: 12px; margin: 2px 3px 2px 0; font-weight: 600; transition: .14s; }
.popup .b-send { background: var(--cyan); color: #fff; }
.popup .b-send:hover { background: #1d4fd8; }
.popup .b-track { background: var(--bg-2); color: var(--text); border-color: var(--line-2); }
.popup .b-issue { background: var(--lime); color: #fff; }
.popup .b-return { background: var(--bg-2); border-color: var(--line-2); color: var(--text); font-size: 11px; padding: 4px 8px; }
.popup .equip-line { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; }
.popup .equip-returned { text-decoration: line-through; color: var(--muted); }
.popup hr { border: none; border-top: 1px solid var(--line); margin: 9px 0; }

/* ── MAP MARKERS (divIcon) ── */
.vmarker { background: none !important; border: none !important; }
.vm {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px; font-weight: 700; color: #fff;
  background: var(--c, #888); border: 2.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(16,24,40,.12), 0 2px 6px rgba(16,24,40,.35);
  text-shadow: 0 1px 1px rgba(0,0,0,.35); transition: transform .12s;
}
.vm:hover { transform: scale(1.12); z-index: 5; }
.vm.off { background: #aeb8c9; box-shadow: 0 1px 3px rgba(16,24,40,.2); color: #fff; opacity: .85; }
.vm.leader { width: 32px; height: 32px; border-color: #fff; box-shadow: 0 0 0 2px var(--amber), 0 2px 8px rgba(16,24,40,.4); }
.vm .vstar { position: absolute; top: -11px; font-size: 13px; color: var(--amber); text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.vm.sos { background: var(--red) !important; color: #fff; animation: sospulse 1.1s infinite; }
.vm.sel { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--cyan), 0 2px 8px rgba(37,99,235,.5); }
@keyframes sospulse { 0%,100% { box-shadow: 0 0 0 3px rgba(225,29,72,.45), 0 2px 8px rgba(225,29,72,.5); } 50% { box-shadow: 0 0 0 13px rgba(225,29,72,0), 0 2px 10px rgba(225,29,72,.5); } }

.marker-label { background: rgba(255,255,255,.94); color: var(--text); padding: 2px 7px; border-radius: 6px; font-size: 11px; white-space: nowrap; border: 1px solid var(--line-2); box-shadow: var(--sh-sm); font-weight: 500; }
.marker-label::before { border-top-color: rgba(255,255,255,.94) !important; }
.sector-label { background: rgba(255,255,255,.9); color: var(--text); padding: 2px 8px; border-radius: 6px; font-size: 11px; border: 1px solid var(--line-2); font-weight: 600; font-family: var(--mono); box-shadow: var(--sh-sm); }
.poi-icon { background: none !important; border: none !important; }
.poi-pin { display: flex; flex-direction: column; align-items: center; }
.poi-pin .ico { font-size: 22px; filter: drop-shadow(0 2px 3px rgba(16,24,40,.35)); }
.poi-pin .lbl { background: rgba(255,255,255,.94); color: var(--text); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 6px; font-size: 10px; white-space: nowrap; margin-top: -3px; box-shadow: var(--sh-sm); font-weight: 500; }

/* ── MODALS ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(27,36,50,.35); z-index: 2000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(3px); animation: fadein .16s ease; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; width: 420px; max-width: 92vw; height: 70vh; display: flex; flex-direction: column; box-shadow: var(--sh-lg); animation: pop .24s cubic-bezier(.2,.8,.25,1); }
.modal-sm { height: auto; max-height: 72vh; width: 384px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head b { letter-spacing: .3px; }
.convo { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 14px; animation: fadein .18s ease; box-shadow: var(--sh-sm); }
.bubble.out { align-self: flex-end; background: var(--cyan); color: #fff; border-bottom-right-radius: 4px; }
.bubble.in { align-self: flex-start; background: var(--bg-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble-text { word-break: break-word; }
.bubble-author { font-size: 11px; font-weight: 700; color: var(--cyan); margin-bottom: 2px; }
.bubble.in .bubble-author { color: var(--magenta); }
.bubble-time { font-size: 10px; opacity: .7; margin-top: 3px; text-align: right; font-family: var(--mono); }
.convo-input { display: flex; gap: 8px; padding: 13px 14px; border-top: 1px solid var(--line); }
.role-edit-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.role-edit-row input[type=color] { width: 36px; height: 36px; padding: 0; border: 1px solid var(--line-2); border-radius: 9px; flex: none; background: #fff; }

/* ── TOASTS ── */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 3000; display: flex; flex-direction: column; gap: 9px; }
.toast {
  min-width: 220px; max-width: 320px; padding: 12px 14px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line-2); color: var(--text);
  box-shadow: var(--sh-lg); font-size: 13px; animation: toastin .28s cubic-bezier(.2,.8,.25,1);
  border-left: 4px solid var(--muted);
}
@keyframes toastin { from { transform: translateX(30px); opacity: 0; } }
.toast.ok { border-left-color: var(--lime); }
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
.toast.sos { border-left-color: var(--red); box-shadow: 0 8px 30px rgba(225,29,72,.28); }
.toast .tt { font-weight: 700; margin-bottom: 2px; }

/* ── ROLES & GROUPS (вкладка Групи) ── */
.sect-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 6px 0 10px; }
.swatch { position: relative; width: 42px; height: 42px; flex: none; cursor: pointer; }
.swatch input[type=color] { position: absolute; inset: 0; opacity: 0; cursor: pointer; padding: 0; border: none; width: 100%; height: 100%; }
.swatch span { display: block; width: 100%; height: 100%; border-radius: 11px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-2), var(--sh-sm); transition: transform .12s; }
.swatch:hover span { transform: scale(1.06); }
.role-row { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.role-row .inline-name { flex: 1; }
.role-row.add { margin-top: 4px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.count-badge { font-family: var(--mono); font-size: 11px; color: var(--muted); background: var(--bg-2); border: 1px solid var(--line); border-radius: 20px; padding: 3px 9px; white-space: nowrap; }
.create-card { display: flex; align-items: center; gap: 9px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 12px; }
.create-card input:not([type=color]) { flex: 1; }
.empty-state { text-align: center; color: var(--muted); background: var(--panel-2); border: 1px dashed var(--line-2); border-radius: 12px; padding: 22px 14px; line-height: 1.6; }

.grp-card2 { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--gc, var(--cyan)); border-radius: 12px; padding: 12px; margin-bottom: 11px; box-shadow: var(--sh-sm); transition: box-shadow .15s; }
.grp-card2:hover { box-shadow: var(--sh-md); }
.grp-head2 { display: flex; align-items: center; gap: 8px; }
.grp-color { width: 13px; height: 13px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.grp-name { flex: 1; font-size: 14.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mini-badge { font-family: var(--mono); font-size: 10.5px; color: var(--muted); background: var(--bg-2); border: 1px solid var(--line); border-radius: 20px; padding: 2px 8px; white-space: nowrap; }
.mini-badge.on { color: var(--lime); border-color: rgba(21,163,74,.3); background: var(--lime-15); }
.grp-head2 .grp-actions { margin-left: 4px; }
.member-list { margin-top: 8px; }
.member-chip { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.avatar.sm { width: 28px; height: 28px; border-radius: 9px; font-size: 10px; }
.avatar.sm .pr { width: 9px; height: 9px; right: -2px; bottom: -2px; }
.member-name { flex: 1; min-width: 0; font-size: 13px; display: flex; align-items: center; gap: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-role { flex: none; }

/* ── VOLUNTEER CARD (модалка волонтера) ── */
.modal-card { width: 440px; height: auto; max-height: 84vh; }
.card-head { gap: 11px; }
.card-head .avatar { width: 40px; height: 40px; border-radius: 12px; font-size: 13px; }
.card-name { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card-sub { margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-body { padding: 14px 16px 16px; overflow-y: auto; }
.card-status { display: flex; align-items: center; gap: 12px; padding: 9px 12px; background: var(--bg-2); border-radius: 10px; margin-bottom: 12px; font-size: 13px; }
.card-status .online-dot { margin-right: 6px; }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.card-actions button { padding: 10px; font-size: 13px; }
.equip-row { display: flex; align-items: center; gap: 6px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.equip-row.returned span { text-decoration: line-through; color: var(--muted); }

/* ── INVENTORY (склад + облік) ── */
.inv-bar { height: 7px; border-radius: 5px; background: var(--line); overflow: hidden; margin: 9px 0 7px; }
.inv-bar-fill { height: 100%; background: var(--lime); border-radius: 5px; transition: width .3s ease; }
.inv-bar-fill.full { background: var(--red); }
.inv-stat { display: flex; align-items: center; gap: 14px; }
.inv-total { margin-left: auto; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; display: flex; align-items: center; gap: 6px; }
.inv-total input { width: 58px; padding: 5px 7px; font-family: var(--mono); }
.ledger { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ledger th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 6px 6px; border-bottom: 1px solid var(--line-2); font-weight: 700; }
.ledger td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ledger tr.returned td { color: var(--muted); text-decoration: line-through; }
.ledger tr.returned td.ledger-act { text-decoration: none; }
.ledger-act { display: flex; gap: 3px; justify-content: flex-end; white-space: nowrap; }
.ledger tbody tr:hover { background: var(--bg-2); }

/* ── COMMS: чати командирів ── */
.cmd-card { display: flex; align-items: center; gap: 11px; padding: 11px; margin-bottom: 9px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--gc, var(--cyan)); border-radius: 12px; cursor: pointer; box-shadow: var(--sh-sm); transition: box-shadow .15s, transform .1s; }
.cmd-card:hover { box-shadow: var(--sh-md); transform: translateY(-1px); }
.cmd-main { flex: 1; min-width: 0; }
.cmd-group { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.cmd-leader { color: var(--muted); font-size: 12px; margin-top: 2px; }
.cmd-chat-ico { font-size: 18px; flex: none; }

.comms-tab.chat-mode { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.inline-chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-bottom: 1px solid var(--line); border-top: 3px solid var(--gc, var(--cyan)); background: linear-gradient(180deg, #fafcff, #fff); }
.chat-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub { display: flex; align-items: center; gap: 8px; font-size: 11.5px; margin-top: 2px; }
.chat-grp { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.inline-chat .convo { flex: 1; background: var(--bg); }
.inline-chat .convo-input { background: #fff; }

/* ── CONTEXT MENU (права кнопка) ── */
.ctx-menu {
  position: fixed; z-index: 2500; min-width: 210px; max-width: 240px;
  background: #fff; border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: var(--sh-lg); padding: 6px; animation: pop .13s ease;
  max-height: 80vh; overflow-y: auto;
}
.ctx-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 6px 10px 7px; border-bottom: 1px solid var(--line); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-item { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; background: none; border: none; color: var(--text); padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.ctx-item:hover { background: var(--cyan-15); color: var(--cyan); }
.ctx-item.danger { color: var(--red); }
.ctx-item.danger:hover { background: var(--red-15); color: var(--red); }
.ctx-ico { width: 18px; text-align: center; font-size: 14px; flex: none; }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.icon-btn.danger-icon:hover { border-color: var(--red); color: var(--red); background: var(--red-15); }

/* ── МУЛЬТИВИБІР ЮНІТІВ ── */
.sel-bar {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 650;
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: rgba(255,255,255,.97); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: var(--sh-lg); backdrop-filter: blur(8px); animation: pop .2s ease; max-width: 92vw;
}
.sel-count { font-size: 13px; white-space: nowrap; }
.sel-count b { color: var(--cyan); font-family: var(--mono); }
.sel-names { font-size: 12px; color: var(--muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-bar .neon { padding: 8px 13px; white-space: nowrap; }
.sel-chk { width: 17px; height: 17px; accent-color: var(--cyan); cursor: pointer; flex: none; }
.list-row.picked { background: var(--cyan-15); box-shadow: inset 3px 0 0 var(--cyan); }
.dispatch-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.dispatch-chip { background: var(--cyan-15); color: var(--cyan); border-radius: 12px; padding: 3px 10px; font-size: 12px; font-weight: 600; }

/* ── ANIMATIONS ── */
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ── жива стрічка подій (дашборд) ── */
.feed { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px; margin-bottom: 14px; background: var(--panel-2); }
.feed-row { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-bottom: 1px solid var(--line); }
.feed-row:last-child { border-bottom: none; }
.feed-ico { flex: none; font-size: 15px; }
.feed-txt { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── непрочитані чати ── */
.cmd-card.unread { box-shadow: inset 3px 0 0 var(--lime); }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); flex: none; box-shadow: 0 0 6px var(--lime); margin-left: 4px; }

/* ── ТЕМНА ТЕМА ── */
html.theme-dark {
  --bg: #0e1420; --bg-2: #172033; --panel: #131b2a; --panel-2: #1a2436; --surface: #131b2a;
  --line: #24304a; --line-2: #33415f;
  --text: #e6ecf6; --muted: #8a97ad;
  --cyan: #3b82f6; --cyan-15: rgba(59,130,246,.20); --cyan-25: rgba(59,130,246,.30);
}
html.theme-dark body, html.theme-dark #app { background: var(--bg); color: var(--text); }
html.theme-dark .icon-btn { background: var(--bg-2); }
html.theme-dark input, html.theme-dark select, html.theme-dark textarea { background: var(--bg-2); color: var(--text); }
html.theme-dark .rail { background: linear-gradient(180deg, #131b2a, #0e1420); }
html.theme-dark #map { background: #0e1420; }
html.theme-dark .leaflet-tile-pane { filter: brightness(.8) contrast(1.05); }

html.theme-dark .subtabs { background: linear-gradient(180deg, #172033, #131b2a); }
html.theme-dark .subtabs button.active { background: var(--bg-2); }
