:root {
  --bg: #0b1a22;
  --bg-2: #10232d;
  --bg-3: #163240;
  --line: #21414f;
  --text: #dbe7ec;
  --muted: #7f9aa6;
  --accent: #4fc3d9;
  --red: #ff5a4e;
  --amber: #f5b13d;
  --green: #4fd18b;
  --violet: #b48cff;
  --radius: 8px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;   /* цифры — моноширинные за счёт tnum */
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font);
  font-feature-settings: "tnum" 1, "cv11" 1; letter-spacing: -0.003em; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* ---------- верхняя панель ---------- */
.topbar {
  height: 52px; display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: var(--bg-2); border-bottom: 1px solid var(--line); position: relative; z-index: 1001;
}
.brand { font-weight: 600; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; font-size: 16px; white-space: nowrap; }
.brand-dim { color: var(--muted); font-weight: 400; margin-left: 4px; }
.brand-mark { width: 14px; height: 14px; background: var(--red); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.brand.big { font-size: 22px; }
.chips { display: flex; gap: 8px; flex: 1; min-width: 0; overflow: hidden; }
.chip {
  font: 12px var(--mono); padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); white-space: nowrap;
}
.chip.live { color: var(--green); border-color: #2b6b4c; }
.chip.demo { color: var(--amber); border-color: #6b5521; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions form { margin: 0; }
.icon-btn { position: relative; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 6px; }
.icon-btn:hover { color: var(--text); background: var(--bg-3); }
.badge {
  position: absolute; top: 0; right: -2px; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--red); color: #fff; border-radius: 9px; font: 600 11px/17px var(--font); text-align: center;
}

/* ---------- раскладка ---------- */
.layout { display: flex; height: calc(100% - 52px); }
.sidebar {
  width: 400px; flex: none; background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.map-wrap { flex: 1; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: #0a1418; }

.tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); flex: none; }
.tab {
  flex: 1 0 auto; background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 4px 10px;
  color: var(--muted); cursor: pointer; font-weight: 500; white-space: nowrap; padding: 10px 10px 8px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-count { background: var(--red); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11px; margin-left: 2px; }
.panel { display: none; padding: 14px; overflow-y: auto; flex: 1; min-height: 0; }
.panel.active { display: block; }

.row { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
select, input[type=text], input:not([type]), input[inputmode], input[type=password] {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; min-width: 0;
}
select { flex: 1; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  background: var(--accent); color: #062029; border: 0; border-radius: 6px; padding: 8px 14px;
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.text-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 6px; }
.text-btn:hover { color: var(--text); }
.text-btn.danger:hover { color: var(--red); }

.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
details.card > summary { cursor: pointer; font-weight: 600; list-style: none; }
details.card > summary::before { content: "+ "; color: var(--accent); }
details.card[open] > summary::before { content: "− "; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.span2 { grid-column: span 2; }
.drop {
  margin-top: 12px; border: 1px dashed var(--line); border-radius: var(--radius); padding: 14px;
  text-align: center; color: var(--text); font-size: 13px;
}
.drop.over { border-color: var(--accent); background: rgba(79,195,217,.06); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { text-align: center; padding: 24px 8px; }

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.stat b { display: block; font: 600 20px var(--mono); }
.stat span { color: var(--muted); font-size: 12px; }
.stat.inside b { color: var(--red); } .stat.near b { color: var(--amber); } .stat.safe b { color: var(--green); }

/* ---------- суда ---------- */
.vessel-list, .notif-list, .circ-list { list-style: none; margin: 0; padding: 0; }
.vessel {
  display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: start;
  padding: 10px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 6px;
}
.vessel:hover, .vessel.selected { background: var(--bg-3); }
.vessel .dot { margin-top: 6px; }
.vessel-name { font-weight: 600; }
.vessel-meta { font: 12px var(--mono); color: var(--muted); }
.vessel-zones { font-size: 12px; margin-top: 2px; }
.vessel-zones .in { color: var(--red); } .vessel-zones .nr { color: var(--amber); }
.vessel-del { visibility: hidden; }
.vessel:hover .vessel-del { visibility: visible; }
.fleet-foot { display: flex; justify-content: space-between; margin-top: 12px; }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.s-safe { background: var(--green); } .s-near { background: var(--amber); } .s-inside { background: var(--red); }
.s-none { background: var(--muted); }

/* ---------- зоны ---------- */
.zones-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.check { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; cursor: pointer; }
.region { margin: 14px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.zone-item {
  display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 6px; cursor: pointer;
}
.zone-item:hover { background: var(--bg-3); }
.zone-item.selected { background: var(--bg-3); box-shadow: inset 2px 0 0 #fff; }
.z-search {
  width: 100%; padding: 7px 10px; margin-bottom: 8px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px;
}
.zf-layer { margin-bottom: 8px; }
.zf-layer-head { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); margin: 4px 0; cursor: pointer; }
.z-types-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.fchip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; font: 12px var(--font); cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px; color: var(--muted);
}
.fchip.on { background: var(--bg-3); border-color: #3c6577; color: var(--text); }
.fchip:not(.on) .sw, .fchip:not(.on) .dot { opacity: .35; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 4px; }
.sub-h { font-size: 13px; margin: 18px 0 8px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.ibf-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12px; }
.ibf-table td { padding: 3px 4px; border-top: 1px solid var(--line); vertical-align: top; }
.zone-item .zname { flex: 1; }
.tag { font: 11px var(--mono); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.tag.amended, .tag.added { color: var(--amber); border-color: #6b5521; }
.tag.cond { color: var(--violet); border-color: #4d3b73; }
.tag.review { color: var(--red); border-color: #74302b; }

/* ---------- уведомления ---------- */
.notif { padding: 10px 8px 10px 12px; border-left: 3px solid var(--line); margin-bottom: 8px; background: var(--bg); border-radius: 0 6px 6px 0; cursor: pointer; }
.notif.critical { border-left-color: var(--red); }
.notif.warning { border-left-color: var(--amber); }
.notif.info { border-left-color: var(--accent); }
.notif.unread { background: var(--bg-3); }
.notif-title { font-weight: 600; }
.notif.read .notif-title { font-weight: 400; color: #b7c8cf; }
.notif-body { color: var(--muted); font-size: 13px; white-space: pre-line; margin-top: 2px; }
.notif-time { font: 11px var(--mono); color: var(--muted); }

/* ---------- циркуляры ---------- */
.circ { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; background: var(--bg); }
.circ-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.circ-ref { font: 600 15px var(--mono); }
.st { font: 11px var(--mono); padding: 1px 6px; border-radius: 4px; }
.st-active { background: rgba(79,209,139,.15); color: var(--green); }
.st-superseded { background: var(--bg-3); color: var(--muted); }
.st-building, .st-new { background: rgba(245,177,61,.15); color: var(--amber); }
.st-error { background: rgba(255,90,78,.15); color: var(--red); }
.circ ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.circ .review { color: var(--red); }
.circ-actions { margin-top: 8px; display: flex; gap: 12px; }
.circ-actions a, .circ-actions button { font-size: 13px; }
pre.log { white-space: pre-wrap; font: 11px var(--mono); color: var(--muted); max-height: 160px; overflow: auto; margin: 6px 0 0; }

/* ---------- карта ---------- */
.legend {
  position: absolute; left: 12px; bottom: 34px; z-index: 500; background: rgba(16,35,45,.92);
  border: 1px solid var(--line); border-radius: var(--radius); font-size: 12px; min-width: 170px;
  /* не выше карты: иначе на телефоне кнопка «Легенда» уходит за верхний край и легенду не свернуть */
  max-height: calc(100% - 150px); display: flex; flex-direction: column;   /* ниже сводки и кнопок «+» / «−» */
}
.legend-toggle { width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; color: var(--muted); cursor: pointer; }
.legend.collapsed .legend-body { display: none; }
.legend-body { padding: 0 10px 10px; display: grid; gap: 5px; flex: 1 1 auto; min-height: 0; overflow: auto; align-content: start; }
.legend-toggle { flex: none; }
.lg { display: flex; align-items: center; gap: 8px; }
.sw { width: 18px; height: 10px; border-radius: 2px; display: inline-block; }
.z-country { background: rgba(255,90,78,.35); border: 1px solid var(--red); }
.z-sea { background: rgba(255,148,64,.35); border: 1px solid #ff9440; }
.z-conditional { background: rgba(180,140,255,.15); border: 1px dashed var(--violet); }
.z-changed { background: transparent; border: 2px dashed #ffe066; }
.sw.is-changed { border: 2px dashed #ffe066; }
.lg-title { margin-top: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
/* SVG-контур зоны получает фокус по клику: без этого браузер рисует белую рамку вокруг всей зоны */
.leaflet-interactive:focus { outline: none; }
.statusbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 24px; z-index: 500; display: flex; justify-content: space-between;
  padding: 0 10px; align-items: center; font: 11px var(--mono); color: var(--muted); background: rgba(11,26,34,.85);
}
.build-banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 600;
  background: var(--bg-2); border: 1px solid #6b5521; color: var(--amber); padding: 8px 14px; border-radius: 999px; font-size: 13px;
}
.leaflet-container { font: 13px var(--font); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--bg-2); color: var(--text); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 12px 14px; max-width: 320px; }
.leaflet-popup-content h4 { margin: 0 0 6px; font-size: 14px; }
.leaflet-popup-content .zt { color: var(--muted); font-size: 12px; white-space: pre-line; max-height: 160px; overflow: auto; }
.leaflet-tooltip { background: var(--bg-2); color: var(--text); border: 1px solid var(--line); }
.leaflet-bar a { background: var(--bg-2); color: var(--text); border-color: var(--line); }
.leaflet-bar a:hover { background: var(--bg-3); }
.leaflet-control-attribution { background: rgba(11,26,34,.7) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.ship-icon svg { filter: drop-shadow(0 0 2px rgba(0,0,0,.8)); }
.ship-badges { position: absolute; left: 60%; top: -9px; display: flex; gap: 1px; pointer-events: none; }
.ship-badges i { width: 14px; height: 14px; border-radius: 50%; font: 700 9px/14px var(--mono, monospace); font-style: normal;
  text-align: center; color: #fff; box-shadow: 0 0 0 1.5px #0b1a22; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-family: var(--mono); }

/* ---------- всплывашки ---------- */
.toasts { position: fixed; top: 64px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; width: 340px; max-width: calc(100vw - 32px); }
.toast {
  background: var(--bg-2); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 6px;
  padding: 10px 12px; box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: slide .2s ease-out; cursor: pointer;
}
.toast.critical { border-left-color: var(--red); } .toast.warning { border-left-color: var(--amber); }
.toast b { display: block; }
.toast span { color: var(--muted); font-size: 13px; }
@keyframes slide { from { transform: translateX(20px); opacity: 0; } }

/* ---------- вход ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 16px;
  background: radial-gradient(1200px 600px at 70% 20%, #12303d, var(--bg)); }
.login-card { width: 100%; max-width: 360px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.login-card input { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.login-error { color: var(--red); min-height: 1em; font-size: 13px; }

/* ---------- мобильная версия ---------- */
.sheet-grip { display: none; }
@media (max-width: 820px) {
  .layout { flex-direction: column-reverse; }
  /* панель с вкладками снизу; высоту меняют, потянув за ручку (--sb-h задаёт скрипт) */
  .sidebar { width: 100%; height: var(--sb-h, 48%); border-right: 0; border-top: 1px solid var(--line); flex: none; }
  .map-wrap { height: auto; flex: 1 1 0; min-height: 0; }
  /* открыта карточка судна: панель с вкладками прячем, карта и карточка — на весь экран */
  body.ship-open .sidebar { display: none; }
  .sheet-grip { display: flex; justify-content: center; align-items: center; height: 22px; flex: none; cursor: ns-resize;
    touch-action: none; user-select: none; }
  .sheet-grip span { width: 44px; height: 5px; border-radius: 3px; background: var(--line); }
  .sheet-grip:active span { background: var(--accent); }
  .sidebar .sheet-grip { position: sticky; top: 0; z-index: 5; background: var(--bg-2); margin: 0 -1px; }
  .chips { display: none; }
  .legend { bottom: 30px; }
  .tab { font-size: 13px; }
}

/* ---------- все суда (AIS) ---------- */
.traffic-card { margin-bottom: 12px; padding: 8px 12px; }
.tc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text); }
#traffic-meta { margin-top: 6px; }
#traffic-meta:empty, #traffic-cats:empty { display: none; }
#traffic-cats { margin-top: 6px; }
/* переключатель вместо галочки */
.switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 34px; height: 20px; margin: 0;
  border-radius: 999px; background: var(--line); cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .35); transition: transform .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(14px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ship-links { margin-top: 8px; color: var(--muted); }
.vessel-meta .dot { width: 8px; height: 8px; vertical-align: middle; }

/* ---------- карточка судна ---------- */
.sc-popup .leaflet-popup-content { margin: 0; width: 310px !important; }      /* карточка порта */
.sc-popup .leaflet-popup-content-wrapper { padding: 0; overflow: hidden; }
.sc-loading { padding: 18px 14px; }
/* карточка судна — панель у правого края карты (на узком экране — снизу), чтобы не закрывать путь судна */
.ship-panel { position: absolute; top: 12px; right: 12px; width: 320px; max-height: calc(100% - 24px); overflow-y: auto;
  z-index: 1000; background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .45); }
.sp-close { position: sticky; top: 0; float: right; z-index: 2; width: 30px; height: 30px; margin-bottom: -30px;
  background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 30px; cursor: pointer; }
.sp-close:hover { color: var(--text); }
@media (max-width: 820px) {
  /* карточка — «шторка» снизу; высоту меняют за ручку, вплоть до всего экрана */
  .ship-panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: var(--sp-h, 58%); max-height: 100%;
    border-radius: 14px 14px 0 0; border-bottom: 0; }
  .ship-panel.full { border-radius: 0; }
  .ship-panel .sheet-grip { position: sticky; top: 0; z-index: 3; background: var(--bg-2); }
  .ship-panel .sp-close { top: 0; z-index: 4; width: 40px; height: 40px; font-size: 24px; margin-bottom: -40px; }
  .ship-panel .sc-photo, .ship-panel .sc-photo img, .ship-panel .sc-photo .sc-sil { height: 150px; }
}
.sc { font-size: 13px; }
.sc-tabs { display: flex; border-bottom: 1px solid var(--line); }
.sc-tabs button { flex: 1; padding: 8px 6px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font: inherit; cursor: pointer; }
.sc-tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.sc-evn { color: var(--accent); font-weight: 600; }
.sc-events { padding: 8px 10px 10px; }
.sc-events.feed-list .feed-item { margin-bottom: 6px; }
@media (max-height: 760px) { .sc-photo, .sc-photo img, .sc-photo .sc-sil { height: 100px; } }
.sc-head { display: flex; gap: 10px; align-items: center; padding: 10px 28px 8px 12px; }
.sc-flag { width: 30px; height: 20px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255,255,255,.15); flex: none; }
.sc-name { font-size: 16px; font-weight: 600; line-height: 1.2; }
.sc-type { font-size: 12px; color: var(--muted); }
.sc-type .dot { width: 8px; height: 8px; vertical-align: middle; }
.sc-photo { position: relative; height: 150px; background: #10232d; }
.sc-photo img, .sc-photo .sc-sil { width: 100%; height: 150px; object-fit: cover; display: block; }
.sc-credit { position: absolute; left: 8px; bottom: 6px; font-size: 10.5px; text-shadow: 0 1px 2px #000; }
.sc-credit a { color: #fff; text-decoration: none; }
.sc-actions { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.sc-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }   /* не шире карточки — без прокрутки вбок */
.sc-actions .btn { flex: 1 1 0; padding: 6px 10px; font-size: 12.5px; text-decoration: none; text-align: center; white-space: nowrap; }
.sc-actions select { flex: 1 1 0; min-width: 0; padding: 6px 5px; font-size: 12.5px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.sc-tag { flex: 1; font-size: 12px; color: var(--muted); }
.sc-route { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px 4px; }
.sc-route b { display: block; font-size: 16px; font-family: var(--mono); }
.sc-eta { text-align: right; }
.sc-zones { padding: 4px 12px 8px; font-size: 12.5px; }
/* риск — сразу под названием судна: красный — в зоне, жёлтый — подходит, зелёный — вне зон */
.sc-risk { margin: 2px 12px 10px; padding: 8px 10px; border-radius: 8px; font-size: 13px; line-height: 1.45;
  border-left: 3px solid var(--green); background: rgba(79, 209, 139, .08); }
.sc-risk.in { border-left-color: var(--red); background: rgba(255, 90, 78, .12); }
.sc-risk.near { border-left-color: var(--amber); background: rgba(245, 177, 61, .10); }
.sc-risk .zin { color: var(--red); font-weight: 600; } .sc-risk .znr { color: var(--amber); } .sc-risk .zok { color: var(--green); font-weight: 600; }
.sc-risk .muted { font-weight: 400; }
.sc-pane .sc-photo { margin: 8px 12px 4px; border-radius: 8px; overflow: hidden; }
.sc-dest { padding: 0 12px 4px; }
.sc-dest:empty { display: none; }
.sc-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.sc-legend i { display: inline-block; width: 22px; height: 0; margin-right: 5px; vertical-align: middle; }
.sc-legend .lg-past { border-top: 2.5px solid #4fc3d9; }
.sc-legend .lg-ahead { border-top: 2px dashed #e8f1f5; }
.sc-legend .lg-ahead.risk { border-top-color: #ff5a4e; }
.sc-legend .lg-ahead.warn { border-top-color: #ffc53d; }
[data-theme=light] .sc-legend .lg-past { border-top-color: #0e7490; }
[data-theme=light] .sc-legend .lg-ahead { border-top-color: #1e293b; }
[data-theme=light] .sc-legend .lg-ahead.risk { border-top-color: #dc2626; }
[data-theme=light] .sc-legend .lg-ahead.warn { border-top-color: #d97706; }
.sc-dest .zin { color: var(--red); } .sc-dest .znr { color: var(--amber); } .sc-dest .zok { color: var(--green); }
.sc-zones .zin { color: var(--red); } .sc-zones .znr { color: var(--amber); } .sc-zones .zok { color: var(--green); }
.sc-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.sc-grid div { padding: 7px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sc-grid div:nth-child(3n) { border-right: 0; }
.sc-grid span { display: block; font-size: 11px; color: var(--muted); }
.sc-grid b { font-size: 12.5px; font-weight: 600; }
.sc-foot { padding: 8px 12px 2px; font-size: 12px; color: var(--muted); }
.sc-foot b { color: var(--text); font-weight: 600; }
.sc-links { padding: 2px 12px 10px; font-size: 11.5px; color: var(--muted); }

/* группа судов на карте */
.tcl div {
  width: 100%; height: 100%; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(22, 60, 92, .92); border: 3px solid #6fa8dc; color: #fff; font: 600 12px var(--font);
  box-shadow: 0 1px 4px rgba(0,0,0,.5); cursor: pointer;
}
.tcl div:hover { background: rgba(35, 90, 130, .95); }

/* ---------- поиск судна ---------- */
.ship-search { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.ship-search input { width: 100%; padding: 7px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.ship-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 2000; max-height: 70vh; overflow: auto;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.sr-item { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px 10px; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.sr-item:hover, .sr-item:focus { background: var(--bg-3); outline: none; }
.sr-item .sc-flag { width: 24px; height: 16px; }
.sr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sr-empty { padding: 10px; }
@media (max-width: 820px) { .ship-search { max-width: none; } .chips { display: none; } }

/* ---------- проверка номера и карточка порта ---------- */
.mmsi-check .ok { color: var(--green); } .mmsi-check .warn { color: var(--amber); }
.mmsi-check .sc-flag { width: 18px; height: 12px; vertical-align: -1px; }
.pc-zones div { display: flex; gap: 6px; align-items: center; margin: 2px 0; }
.pc-cats { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 8px 12px; font-size: 12px; border-bottom: 1px solid var(--line); }
.pc-cat .dot { width: 8px; height: 8px; margin-right: 4px; }
.pc-list { max-height: 220px; overflow: auto; }
.pc-h { position: sticky; top: 0; z-index: 1; padding: 6px 12px 2px; background: var(--bg-2); }
.pc-ship .dot { width: 7px; height: 7px; vertical-align: middle; }
.pc-ship { display: flex; gap: 8px; align-items: center; width: 100%; padding: 6px 12px; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 12.5px; }
.pc-ship:hover { background: var(--bg-3); }
.pc-ship .sc-flag { width: 20px; height: 13px; }

/* ---------- доступ к флоту ---------- */
#fleet-share summary { cursor: pointer; font-weight: 600; }
.share-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.share-row b { flex: 1; }
.share-row select, .share-add select { padding: 4px 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.share-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 4px; }
.share-add select { flex: 1; min-width: 120px; }
#fleet-foot-guest { justify-content: space-between; align-items: center; }

/* ---------- кнопки флота: добавить судно / поделиться ---------- */
.fleet-actions { display: flex; gap: 8px; margin: 12px 0 8px; }
.fleet-actions .btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.fleet-actions .btn.on { background: var(--bg-3); border-color: var(--accent); color: var(--text); }
#add-vessel > summary, #fleet-share > summary { display: none; }
.nowrap { white-space: nowrap; }

/* ---------- происшествия ---------- */
.inc-opts { gap: 10px; align-items: center; margin: 6px 0 8px; }
.inc-opts select { padding: 4px 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.inc-dot { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex: none;
  border-radius: 50%; color: #0b1a22; font: 700 11px var(--font); }
.inc-list { list-style: none; margin: 10px 0 0; padding: 0; }
.inc { display: flex; gap: 10px; padding: 9px 8px; border-bottom: 1px solid var(--line); cursor: pointer; }
.inc:hover { background: var(--bg-3); }
.inc.critical .inc-title { color: var(--red); }
.inc.test { opacity: .6; }
.inc-title { font-weight: 600; }
.inc-text { color: var(--text); margin-top: 2px; font-family: var(--mono); font-size: 12px; word-break: break-word; }
.inc-icon span { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
  color: #0b1a22; font: 700 13px var(--font); border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.6); }
.inc-icon.test span { opacity: .55; }
.inc-icon.urgent span { animation: inc-pulse 1.6s ease-out infinite; }
@keyframes inc-pulse { 0% { box-shadow: 0 0 0 0 rgba(255,59,48,.7); } 100% { box-shadow: 0 0 0 14px rgba(255,59,48,0); } }
@media (prefers-reduced-motion: reduce) { .inc-icon.urgent span { animation: none; } }

/* ---------- правила ---------- */
.rule-form { display: grid; gap: 10px; }
.rule-form label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.rule-form select, .rule-form input[type=text], .rule-form input:not([type]), .rule-form input[type=number] {
  padding: 7px 9px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--text); }
.rule-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rule-checks { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.rule-checks label { display: flex; gap: 5px; align-items: center; color: var(--text); }
.rule-list { list-style: none; margin: 0; padding: 0; }
.rule-item { display: flex; gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.rule-item.off { opacity: .5; }
.rule-item .ri-main { flex: 1; min-width: 0; }
.rule-item .ri-name { font-weight: 600; }
.rule-item .ri-sev { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.rule-item .ri-actions { display: flex; gap: 6px; }
.sub-h .check { display: inline-flex; margin-left: 10px; text-transform: none; letter-spacing: 0; }
.draw-hint { border-color: var(--accent); }
.draw-hint .row { gap: 8px; }
.drawing #map { cursor: crosshair; }

/* ---------- санкции и задержания в карточке ---------- */
.sc-alert { margin: 0 12px 8px; padding: 8px 10px; border-radius: 6px; font-size: 12.5px; line-height: 1.45; }
.sc-alert.sanc { background: rgba(255,59,48,.12); border: 1px solid rgba(255,59,48,.55); }
.sc-alert.det { background: rgba(251,146,60,.1); border: 1px solid rgba(251,146,60,.5); }
.sc-alert b { display: block; margin-bottom: 2px; }
#screen-card { margin-top: 10px; }

/* ---------- «События»: переключатель ---------- */
.seg { display: flex; gap: 4px; padding: 3px; margin-bottom: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.seg-btn { flex: 1; padding: 7px 8px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; font-weight: 500; }
.seg-btn.on { background: var(--bg-3); color: var(--text); }

/* ---------- окно «Источники зон» ---------- */
.chip-btn { cursor: pointer; background: none; }
.chip-btn:hover { color: var(--text); border-color: var(--accent); }
.chip-btn::after { content: " ▾"; }
.modal { position: fixed; inset: 0; z-index: 3000; background: rgba(5, 12, 16, .6); display: flex;
  align-items: flex-start; justify-content: center; padding: 64px 16px 16px; }
.modal-box { width: min(560px, 100%); max-height: calc(100vh - 80px); display: flex; flex-direction: column;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 48px rgba(0,0,0,.5); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 14px 16px; overflow-y: auto; }

/* ---------- легенда-фильтр ---------- */
.lg-hint { font-size: 11px; color: var(--muted); margin: 0 0 4px; }
.lg-btn { width: 100%; background: none; border: 0; padding: 2px 4px; margin: 0 -4px; border-radius: 5px;
  color: inherit; font: inherit; text-align: left; cursor: pointer; }
.lg-btn.lg { display: flex; align-items: center; gap: 8px; }
.lg-btn:hover { background: var(--bg-3); }
.lg-btn.off { opacity: .38; }
.lg-btn.off span { text-decoration: line-through; }
.lg-title.lg-btn { display: block; }

/* ---------- журнал заходов в зоны [журнал-заходов] начало ---------- */
.log-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.log-filters select { flex: 1 1 120px; min-width: 0; }
.log-summary { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.log-summary b { color: var(--text); } .log-summary .warn { color: var(--amber); }
.log-xlsx { display: inline-block; margin-bottom: 10px; text-decoration: none; }
.log-list { list-style: none; margin: 0; padding: 0; }
.log-item { padding: 9px 10px; margin-bottom: 6px; border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 6px; }
.log-item.open { border-left-color: var(--amber); }
.log-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.log-now { font-size: 11px; color: var(--amber); white-space: nowrap; }
.log-item .zin { color: var(--amber); }
/* [журнал-заходов] конец */

/* ---------- лента ---------- */
.feed-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.feed-tools { margin-bottom: 8px; }
.feed-list { list-style: none; margin: 0 0 12px; padding: 0; }
.feed-item { padding: 9px 10px 9px 12px; margin-bottom: 7px; border-left: 3px solid var(--line); border-radius: 0 6px 6px 0;
  background: var(--bg); cursor: pointer; }
.feed-item.critical { border-left-color: var(--red); } .feed-item.warning { border-left-color: var(--amber); }
.feed-item.info { border-left-color: var(--accent); }
/* новое — светлая карточка с яркой полосой и точкой; прочитанное — тёмное и приглушённое */
.feed-item.unread { background: #1b3d4c; box-shadow: inset 0 0 0 1px rgba(79, 195, 217, .18); }
.feed-item.unread .fi-src::before { content: "● "; color: var(--accent); }
.feed-item.read { background: #08141a; border-left-color: #2a3b43; }
.feed-item.read > * { opacity: .55; }
.feed-item.read .fi-event { color: var(--text); }
.feed-item.read:hover > * { opacity: .85; }
.fi-meta { display: flex; align-items: center; gap: 6px; font: 10.5px var(--mono); color: var(--muted); margin-bottom: 4px; }
.fi-meta .inc-dot { width: 16px; height: 16px; font-size: 9px; line-height: 16px; }
.fi-src { text-transform: uppercase; letter-spacing: .05em; }
.fi-time { margin-left: auto; }
.fi-event { font-weight: 700; font-size: 13.5px; line-height: 1.3; }
.feed-item.critical .fi-event { color: #ff8a80; } .feed-item.warning .fi-event { color: #ffc861; }
.feed-item.read .fi-event { font-weight: 600; }
.fi-vessel { margin-top: 3px; font-size: 13px; }
.fi-vessel .muted { font: 11px var(--mono); }
.fi-zone { margin-top: 4px; padding: 3px 8px; font-size: 12px; border-radius: 4px; background: rgba(255, 255, 255, .05);
  border-left: 2px solid var(--line); overflow-wrap: anywhere; }
.fi-lines { list-style: none; margin: 5px 0 0; padding: 0; font-size: 12px; color: var(--muted); }
.fi-lines li { padding: 1px 0 1px 12px; position: relative; overflow-wrap: anywhere; }
.fi-lines li::before { content: "·"; position: absolute; left: 3px; }
.fi-quote { margin-top: 4px; font-size: 12px; color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.fi-link { margin-top: 3px; }
.fi-rule { margin-top: 6px; padding-top: 4px; border-top: 1px dashed var(--line); font-size: 11px; color: var(--muted); }
.feed-more summary { cursor: pointer; font-size: 13px; }
.feed-more[open] summary { margin-bottom: 8px; }

/* ---------- эмблемы зон (как метки областей в играх) ---------- */
.zone-emblem span { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #1b2f38, #0b161c); border: 1.5px solid var(--c);
  box-shadow: 0 0 0 2px rgba(11, 22, 28, .7), 0 0 10px var(--c); cursor: pointer; transition: transform .15s; }
.zone-emblem span svg .f { fill: var(--c); fill-opacity: .35; }
.zone-emblem:hover span { transform: scale(1.15); }
.zone-emblem.sel span { transform: scale(1.2); box-shadow: 0 0 0 2px rgba(11, 22, 28, .7), 0 0 16px var(--c), 0 0 4px #fff; }
.zone-emblem.off span { opacity: .45; box-shadow: none; }

/* ---------- место события на карте ---------- */
.event-spot span { display: block; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--c);
  box-shadow: 0 0 12px var(--c), inset 0 0 8px var(--c); position: relative; animation: ev-pulse 1.6s ease-out infinite; }
.event-spot span::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px;
  border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); }
@keyframes ev-pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.25); opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .event-spot span { animation: none; } }
.ev-pop .fi-lines { margin-bottom: 8px; }
.ev-pop .ev-open { width: 100%; }
.fi-map { color: var(--accent); }
.sc-hin { font-size: 11px; font-family: var(--mono); overflow-wrap: anywhere; }

/* ---------- цвет флота ---------- */
.fleet-chip { display: inline-flex; align-items: center; gap: 4px; margin: 2px 4px 0 0; padding: 1px 7px 1px 5px; font-size: 11px;
  border-radius: 10px; border: 1px solid var(--fc); color: var(--text); background: rgba(255, 255, 255, .04); white-space: nowrap; }
.fleet-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--fc); }

/* ---------- цвет флота: кнопка и палитра ---------- */
.fleet-color-wrap { position: relative; flex: none; }
.fleet-color { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--fc, #4dabf7); cursor: pointer;
  background: radial-gradient(circle, var(--fc, #4dabf7) 0 38%, transparent 40%); box-shadow: 0 0 10px var(--fc, transparent); }
.fleet-palette { position: absolute; z-index: 1200; top: 40px; left: 0; display: grid; grid-template-columns: repeat(5, 28px); gap: 8px;
  padding: 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .5); }
.pal-sw { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--c); cursor: pointer;
  background: radial-gradient(circle, var(--c) 0 38%, transparent 40%); }
.pal-sw.on, .pal-sw:hover { box-shadow: 0 0 0 2px #fff, 0 0 10px var(--c); }

/* ---------- готовые наборы правил ---------- */
.presets summary { cursor: pointer; font-weight: 600; }
.preset { padding: 10px 0; border-top: 1px solid var(--line); }
.preset:first-child { border-top: 0; }
.preset-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 3px; }
.preset-head .btn { padding: 4px 10px; font-size: 12.5px; white-space: nowrap; }
.preset-rules { list-style: none; margin: 5px 0 0; padding: 0; font-size: 12px; color: var(--muted); }
.preset-rules li.on { color: var(--green); }

/* название судна — ссылка на карточку */
.ship-link { color: inherit; text-decoration: underline dotted rgba(127,127,127,.6); text-underline-offset: 3px; cursor: pointer; }
.ship-link:hover { color: var(--accent); text-decoration-color: currentColor; }
.sc-evnote { padding: 10px 2px 2px; line-height: 1.45; }
.sc-note { margin: 8px 12px 0; padding: 7px 10px; border-radius: 6px; background: rgba(245,177,61,.12); color: var(--amber, #f5b13d); font-size: 12.5px; line-height: 1.4; }

/* ---------- обучение ---------- */
.tour-btn { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px 0 6px; border-radius: 15px;
  border: 1px solid var(--line); background: none; color: var(--text); cursor: pointer; white-space: nowrap; }
.tour-btn:hover { border-color: var(--accent); }
.tour-btn span { width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; font: 700 12px/1 var(--font);
  background: var(--accent); color: var(--bg); }
.tour-btn b { font-weight: 500; font-size: 13px; }
@media (max-width: 900px) { .tour-btn { padding: 0 5px; } .tour-btn b { display: none; } }
.tour { position: fixed; inset: 0; z-index: 5000; }
.tour-spot { position: fixed; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(3, 10, 14, .68); outline: 2px solid var(--accent);
  pointer-events: none; transition: all .25s ease; }
.tour-card { position: fixed; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45); transition: left .25s ease, top .25s ease; }
.tour-card h4 { margin: 2px 24px 6px 0; font-size: 15px; }
.tour-card p { margin: 0 0 12px; color: var(--text); line-height: 1.45; }
.tour-step { font: 11px/1 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tour-x { position: absolute; top: 8px; right: 8px; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; }
.tour-x:hover { color: var(--text); }
.tour-nav { display: flex; justify-content: space-between; align-items: center; }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-card { transition: none; } }
.lg-n { margin-left: auto; padding-left: 8px; font: 11px/1 var(--mono); font-style: normal; color: var(--muted); }
.lg-btn.off .inc-dot { text-decoration: none; }
#chip-clock { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 900px) { #chip-clock { display: none; } }
.tour-card p.tour-ex { margin-top: -4px; padding: 7px 10px; border-left: 2px solid var(--accent); background: rgba(79,195,217,.08); border-radius: 0 6px 6px 0; font-size: 13px; color: var(--text); }
.tour-ex b { color: var(--accent); font-weight: 600; }

/* важное и удаление в ленте */
.fi-acts { display: inline-flex; gap: 2px; margin-left: 4px; }
.fi-act { background: none; border: 0; padding: 0 4px; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; opacity: .45; }
.feed-item:hover .fi-act, .fi-act:focus-visible { opacity: 1; }
.fi-act:hover { color: var(--text); }
.fi-act[data-act=del]:hover { color: var(--red); }
.fi-star.on { color: #ffd166; opacity: 1; }
.feed-item.starred { box-shadow: inset 0 0 0 1px rgba(255, 209, 102, .45); }
.feed-item.read > .fi-meta { opacity: 1; }
.feed-item.read > .fi-meta > :not(.fi-acts) { opacity: .55; }
@media (hover: none) { .fi-act { opacity: .8; } }
.fi-src { white-space: nowrap; }
.lg-read { background: #4b5d66 !important; font-size: 10px; }
.feed-item.trash { cursor: default; }
.trash-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.feed-item.trash > .trash-row { opacity: 1; }
.trash-note { padding: 0 2px 8px; list-style: none; }
.pop-acts { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.pop-acts .btn { flex: 1; padding: 5px 8px; font-size: 12.5px; }
.pop-acts .btn.on { color: #ffd166; border-color: rgba(255, 209, 102, .5); }
.pop-acts [data-pop=del]:hover { color: var(--red); border-color: var(--red); }
@media (max-width: 820px) {
  /* шторки плавно переезжают между положениями; во время жеста — без задержки за пальцем */
  .sidebar, .ship-panel { transition: height .2s ease; }
  .sidebar.dragging, .ship-panel.dragging { transition: none; }
  #sidebar .tabs { touch-action: pan-x; }
  .sidebar.min .panel { visibility: hidden; }
  .ship-panel.min { overflow: hidden; }
}

/* ---------- компьютер: левая панель сворачивается ---------- */
@media (min-width: 821px) {
  .sidebar { transition: width .2s ease, border-color .2s; overflow: hidden; }
  body.sb-collapsed .sidebar { width: 0; border-right-color: transparent; }
}
@media (max-width: 820px) { .sb-toggle, .sb-rail { display: none !important; } }

/* ---------- лента: одна строка фильтров ---------- */
.feed-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line); }
.seg-b { border: 0; background: none; color: var(--muted); padding: 5px 10px; border-radius: 7px; cursor: pointer; font-size: 12.5px; white-space: nowrap; }
.seg-b:hover { color: var(--text); }
.seg-b.on { background: var(--bg-3); color: var(--text); font-weight: 600; }
.feed-icons { display: inline-flex; gap: 2px; }
.ico-b { position: relative; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px;
  background: none; color: var(--muted); cursor: pointer; }
.ico-b svg { width: 17px; height: 17px; fill: currentColor; stroke: currentColor; stroke-width: 0; }
#btn-read-all svg { fill: none; stroke-width: 2.2; }
.ico-b:hover { background: var(--bg-3); color: var(--text); }
.ico-b.on, .ico-b[aria-pressed=true] { background: var(--bg-3); color: var(--accent); }
.ico-b[data-feed=starred].on { color: #ffd166; }
.ico-n { position: absolute; top: 1px; right: 0; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px;
  background: var(--muted); color: var(--bg); font: 700 9px/14px var(--font); }

/* ---------- вкладки: Флот · Лента · Зоны + шестерёнка настройки уведомлений ---------- */
.tab-ico { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; }
.tab-ico svg { width: 17px; height: 17px; fill: currentColor; }
.tab-ico-label { font-size: 12.5px; }
.back-btn { margin: 0 0 8px -6px; }
.fleet-actions { flex-wrap: wrap; }

/* ---------- соседние происшествия — одним кружком с числом ---------- */
.inc-cluster span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  font: 700 12px/1 var(--font); color: #fff; background: #4b6472; border: 2px solid rgba(255, 255, 255, .85);
  box-shadow: 0 1px 6px rgba(0, 0, 0, .45); }
.inc-cluster.warning span { background: #c27a12; }
.inc-cluster.critical span { background: #d63a30; }

/* ---------- сводка над картой ---------- */
.riskbar { position: absolute; top: 10px; left: 54px; z-index: 950; display: flex; gap: 6px; flex-wrap: wrap; max-width: calc(100% - 70px); }
.rb { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px 0 9px; border-radius: 16px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(16, 35, 45, .92); color: var(--text); font: inherit; font-size: 12.5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .3); backdrop-filter: blur(6px); }
.rb:hover { border-color: var(--accent); }
.rb i { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.rb.in i { background: var(--red); } .rb.near i { background: var(--amber); } .rb.new i { background: var(--accent); }
.rb b { font-size: 14px; }
.rb.in:not(.zero) b { color: var(--red); } .rb.near:not(.zero) b { color: var(--amber); }
.rb.zero { opacity: .65; }
.rb span { color: var(--muted); }
.rb-pop { position: absolute; top: 40px; left: 0; width: 330px; max-height: 50vh; overflow: auto; padding: 6px; border-radius: 12px;
  background: var(--bg-2); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.rb-h { padding: 6px 8px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.rb-v { display: block; width: 100%; text-align: left; padding: 7px 8px; border: 0; border-radius: 8px; background: none; color: var(--text); cursor: pointer; font: inherit; }
.rb-v:hover { background: var(--bg-3); }
.rb-v .rb-z { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.rb-empty { padding: 8px; color: var(--muted); }
@media (max-width: 820px) {
  .riskbar { left: 52px; top: 8px; gap: 4px; }
  .rb { height: 30px; padding: 0 9px 0 7px; }
  .rb span { display: none; }                         /* на телефоне — только числа с цветной точкой */
  .rb-pop { width: min(330px, calc(100vw - 70px)); }
}

/* =====================================================================================
   ТЕМЫ: тёмная (по умолчанию в стилях выше) и светлая — [data-theme=light] на <html>.
   Выбор — кнопкой в шапке (запоминается), без выбора — как в системе.
   ===================================================================================== */
:root[data-theme=light] {
  --bg: #f4f6f9; --bg-2: #ffffff; --bg-3: #eef2f6; --line: #e2e8ef;
  --text: #0f172a; --muted: #64748b; --accent: #0e7490;
  --red: #dc2626; --amber: #c2410c; --green: #15803d; --violet: #7c3aed;
  color-scheme: light;
}
[data-theme=light] .topbar { background: #fff; border-bottom-color: transparent; box-shadow: 0 1px 0 #e9edf2, 0 2px 12px rgba(15, 23, 42, .04); }
[data-theme=light] .chip { background: var(--bg-3); border-color: transparent; }
[data-theme=light] .chip.live { background: #dcfce7; color: #15803d; }
[data-theme=light] .chip.demo { background: #ffedd5; color: #c2410c; }
[data-theme=light] .ship-search input { background: var(--bg-3); border-color: transparent; }
[data-theme=light] .ship-search input:focus { background: #fff; border-color: #a5d8e6; box-shadow: 0 0 0 3px rgba(14, 116, 144, .12); }
[data-theme=light] #map { background: #e9edf1; }
[data-theme=light] .btn { color: #fff; }
[data-theme=light] .btn.ghost { color: var(--text); background: #fff; }
[data-theme=light] .fchip.on { background: #ecfeff; border-color: #a5e3ee; color: #0e7490; }
[data-theme=light] .tag.amended, [data-theme=light] .tag.added { border-color: #fdba74; }
[data-theme=light] .legend { background: rgba(255, 255, 255, .96); border-color: transparent; box-shadow: 0 6px 24px rgba(15, 23, 42, .12); }
[data-theme=light] .statusbar { background: rgba(255, 255, 255, .82); color: #94a3b8; }
[data-theme=light] .leaflet-control-attribution { background: rgba(255, 255, 255, .7) !important; color: #94a3b8 !important; }
[data-theme=light] .leaflet-control-attribution a { color: #64748b; }
[data-theme=light] .leaflet-popup-content-wrapper, [data-theme=light] .leaflet-popup-tip,
[data-theme=light] .leaflet-tooltip { border-color: transparent; box-shadow: 0 8px 28px rgba(15, 23, 42, .16); }
[data-theme=light] .login-body { background: radial-gradient(1200px 600px at 70% 20%, #e0f2f7, var(--bg)); }
[data-theme=light] .sc-photo { background: #eef3f6; }
[data-theme=light] #sc-sky stop:first-child { stop-color: #f1f6f9; }
[data-theme=light] #sc-sky stop:last-child { stop-color: #e2ebf0; }
[data-theme=light] .sc-sil > path:last-child { fill: #c9dbe5; opacity: 1; }
[data-theme=light] .sc-credit { color: #64748b; text-shadow: none; }
[data-theme=light] .sc-credit a { color: #475569; }
[data-theme=light] .modal { background: rgba(15, 23, 42, .35); }
[data-theme=light] .rb { background: rgba(255, 255, 255, .96); border-color: transparent; box-shadow: 0 4px 14px rgba(15, 23, 42, .12); }
[data-theme=light] .rb-pop { box-shadow: 0 12px 34px rgba(15, 23, 42, .16); border-color: transparent; }
[data-theme=light] .ico-n { color: #fff; }
[data-theme=light] .ship-icon svg { filter: drop-shadow(0 1px 1.5px rgba(15, 23, 42, .35)); }
[data-theme=light] .inc-icon span { box-shadow: 0 1px 4px rgba(15, 23, 42, .25); }
[data-theme=light] .zone-emblem span { background: #fff; box-shadow: 0 2px 6px rgba(15, 23, 42, .2); }
[data-theme=light] .zone-emblem.sel span { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--c); }
[data-theme=light] .sc-risk.in { background: #fef2f2; } [data-theme=light] .sc-risk.near { background: #fff7ed; }
[data-theme=light] .sc-risk { background: #f0fdf4; }
[data-theme=light] .toast { box-shadow: 0 10px 30px rgba(15, 23, 42, .16); }
[data-theme=light] .tour-spot { box-shadow: 0 0 0 9999px rgba(15, 23, 42, .45); }
/* лента: белые карточки без толстых цветных полос; новое — голубоватое с полоской, прочитанное — серое */
[data-theme=light] .feed-item { background: #fff; border: 1px solid var(--line); border-left-width: 1px; border-radius: 12px; position: relative; }
[data-theme=light] .feed-item.unread { background: #f0fbfd; border-color: #bfe7ef; box-shadow: none; }
[data-theme=light] .feed-item.unread::before { content: ""; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent); }
[data-theme=light] .feed-item.read { background: #fff; border-color: var(--line); }
[data-theme=light] .feed-item.read > * { opacity: .75; }
[data-theme=light] .feed-item.critical .fi-event { color: #b91c1c; } [data-theme=light] .feed-item.warning .fi-event { color: #b45309; }
[data-theme=light] .feed-item.starred { box-shadow: inset 0 0 0 1px rgba(217, 119, 6, .45); }
[data-theme=light] .fi-zone { background: var(--bg-3); border-left: 0; border-radius: 8px; }
[data-theme=light] .fi-star.on, [data-theme=light] .ico-b[data-feed=starred].on { color: #d97706; }
[data-theme=light] .inc-cluster span { border-color: #fff; box-shadow: 0 2px 8px rgba(15, 23, 42, .3); }

/* кнопка темы в шапке */
.theme-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 0; background: none;
  color: var(--muted); cursor: pointer; }
.theme-btn:hover { background: var(--bg-3); color: var(--text); }
.theme-btn svg { width: 18px; height: 18px; fill: currentColor; }
.theme-btn .i-sun { display: none; } [data-theme=light] .theme-btn .i-sun { display: block; } [data-theme=light] .theme-btn .i-moon { display: none; }

/* =====================================================================================
   КОМПЬЮТЕР: карта на всю ширину, левая панель и карточка судна — «острова» над ней
   ===================================================================================== */
@media (min-width: 821px) {
  .layout { position: relative; }
  .map-wrap { position: absolute; inset: 0; }
  .sidebar { position: absolute; z-index: 1001; top: 12px; left: 12px; bottom: 36px; width: 392px; border: 1px solid var(--line);
    border-radius: 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, .35); overflow: hidden;
    transition: transform .22s ease, opacity .22s ease; }
  [data-theme=light] .sidebar { border-color: transparent; box-shadow: 0 10px 40px rgba(15, 23, 42, .12), 0 1px 3px rgba(15, 23, 42, .06); }
  body.sb-collapsed .sidebar { width: 392px; transform: translateX(-420px); opacity: 0; pointer-events: none; }
  /* всё, что на карте у левого края, — правее панели */
  .leaflet-left, .riskbar, .legend { transition: transform .22s ease; }
  body:not(.sb-collapsed) .leaflet-left, body:not(.sb-collapsed) .legend { transform: translateX(416px); }
  body:not(.sb-collapsed) .riskbar { transform: translateX(416px); max-width: calc(100% - 500px); }
  /* свёрнуто — справа от полоски со значками */
  body.sb-collapsed .leaflet-left, body.sb-collapsed .legend, body.sb-collapsed .riskbar { transform: translateX(58px); }
  /* кнопка «свернуть» — первой в строке вкладок, там же, где «развернуть» на свёрнутой панели */
  .sb-toggle { flex: none; width: 32px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px;
    background: none; color: var(--accent); cursor: pointer; }
  .sb-toggle:hover { background: var(--bg-3); }
  .sb-toggle svg { width: 18px; height: 18px; }
  /* полоска со значками вкладок, пока панель свёрнута */
  .sb-rail { position: absolute; z-index: 1001; top: 12px; left: 12px; display: none; flex-direction: column; gap: 4px; padding: 6px;
    background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, .35); }
  [data-theme=light] .sb-rail { border-color: transparent; box-shadow: 0 8px 28px rgba(15, 23, 42, .12); }
  body.sb-collapsed .sb-rail { display: flex; }
  .sb-rail button { position: relative; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 9px;
    background: none; color: var(--muted); cursor: pointer; }
  .sb-rail button:hover { background: var(--bg-3); color: var(--text); }
  .sb-rail svg { width: 18px; height: 18px; }
  .sb-rail .rail-open { color: var(--accent); border-bottom: 1px solid var(--line); border-radius: 9px 9px 4px 4px; margin-bottom: 2px; }
  .rail-n { position: absolute; top: 0; right: -2px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px;
    background: var(--red); color: #fff; font: 700 9px/15px var(--font); }
  .ship-panel { top: 12px; right: 12px; border-radius: 16px; max-height: calc(100% - 48px); }   /* не закрывает строку внизу */
  [data-theme=light] .ship-panel { border-color: transparent; box-shadow: 0 10px 40px rgba(15, 23, 42, .14); }
  /* вкладки — переключатель-«таблетка» */
  .tabs { margin: 12px 12px 6px; padding: 3px; background: var(--bg); border: 0; border-radius: 11px; flex-wrap: nowrap; }
  [data-theme=light] .tabs { background: var(--bg-3); }
  .tab { border: 0; border-radius: 8px; padding: 7px 8px; font-size: 13px; }
  .tab.active { background: var(--bg-3); border: 0; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
  [data-theme=light] .tab.active { background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
}

/* шапка на телефоне: «Выйти» — значком, название короче — чтобы поиску хватило места */
.logout-btn svg { display: none; width: 20px; height: 20px; }
@media (max-width: 820px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .brand { font-size: 15px; }
  .logout-btn span { display: none; }
  .logout-btn svg { display: block; }
  .theme-btn { width: 30px; height: 30px; }
  .ship-search { min-width: 0; flex: 1 1 auto; }
}

/* кнопки масштаба: неактивная (на пределе масштаба) — приглушённая, а не белая */
.leaflet-bar a.leaflet-disabled { background: var(--bg-2); color: var(--muted); opacity: .45; cursor: default; }
[data-theme=light] .leaflet-bar a.leaflet-disabled { background: #fff; }

/* строка внизу карты (координаты, масштаб, версия зон) — ничем не закрыта: подпись карты и кнопки — над ней */
.leaflet-bottom { bottom: 24px; }

/* просмотренные происшествия, когда их показ включён, — бледные: видно, что уже смотрели */
.inc-icon.seen { opacity: .45; }
.inc-icon.seen:hover { opacity: .9; }

/* ---------- досье судна (Data Docked) [data-docked] начало ---------- */
.dos { padding: 10px 0 12px; font-size: 12.5px; }
.dos > p, .dos > h4, .dos > ul, .dos > button { margin-left: 12px; margin-right: 12px; }
.dos h4 { margin-top: 12px; margin-bottom: 4px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.dos ul { margin-top: 0; margin-bottom: 0; padding-left: 16px; line-height: 1.5; }
.dos .sc-alert.ok { background: rgba(52,199,89,.1); border: 1px solid rgba(52,199,89,.45); }
.dos-grid { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); margin-top: 4px; }
.dos-grid div { padding: 7px 12px; border-bottom: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
.dos-grid div:nth-child(odd) { border-right: 1px solid var(--line); }
.dos-grid span { display: block; font-size: 11px; color: var(--muted); }
.dos-grid b { font-weight: 600; }
.dos-grid small { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; }
.dos-det { color: #e5484d; margin-left: 4px; }
/* [data-docked] конец */
/* [data-docked] начало */
.sr-dd { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 10px 12px; border: 0;
  border-top: 1px solid var(--line); background: none; color: var(--accent); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.sr-dd:hover { background: var(--bg); }
.sr-dd .muted { font-weight: 400; }
.dd-voy { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); line-height: 1.5; }
/* [data-docked] конец */

/* ---------- язык и пользователи ---------- */
.lang-btn { height: 30px; min-width: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: none;
  color: var(--muted); font: 600 12px/1 var(--font, inherit); letter-spacing: .04em; cursor: pointer; }
.lang-btn:hover { color: var(--text); border-color: var(--accent); }
.login-lang { display: block; margin: 14px auto 0; }
.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.users-table .u-acts { text-align: right; white-space: nowrap; }
.users-table select { max-width: 150px; }
.users-table .u-credits { white-space: nowrap; }
.users-table .u-visits { white-space: nowrap; }
#users-modal .modal-box { width: min(720px, 100%); }
#users-list { overflow-x: auto; }
.act-day { margin: 14px 0 4px; font-size: 13px; }
.act-table td { padding: 5px 6px; }
#users-add input { flex: 1; min-width: 140px; }
.users-pwd { margin-top: 12px; font-size: 13px; }
.users-pwd .pwd { font: 600 15px var(--mono, monospace); padding: 6px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; user-select: all; }
@media (max-width: 820px) { .lang-btn { min-width: 30px; padding: 0 6px; } }
/* обучение: вступление — без подсветки */
.tour.centered .tour-spot { display: none; }
.tour.centered { background: rgba(3, 10, 14, .55); }
/* телефон: в шапке только значок FleetRisk — место поиску (рядом кнопки темы, языка, обучения) */
@media (max-width: 480px) { .topbar .brand { font-size: 0; gap: 0; } .topbar .brand .brand-mark { margin-right: 0; } }

/* ---------- машина времени [машина-времени] начало ---------- */
.tm-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 4px; border: 2px solid rgba(0,0,0,.2);
  background: var(--bg-2); color: var(--text); cursor: pointer; padding: 0; }
.tm-btn svg { width: 18px; height: 18px; }
.tm-on .tm-btn { background: var(--accent); color: #fff; }
.tm { position: absolute; z-index: 650; left: 50%; bottom: 34px; transform: translateX(-50%); width: min(520px, calc(100% - 24px));
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.tm-head { display: flex; align-items: center; gap: 8px; }
.tm-head b { font-size: 13px; letter-spacing: .02em; }
.tm-head select { margin-left: auto; padding: 4px 6px; }
.tm-only { font-size: 12px; padding: 2px 4px 2px 8px; border: 1px solid var(--accent); border-radius: 999px; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.tm-x { margin-left: 2px; }
.tm-time { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 2px; }
.tm-time b { font-size: 15px; font-variant-numeric: tabular-nums; }
.tm input[type=range] { width: 100%; accent-color: var(--accent); margin: 4px 0 0; }
.tm-evs { position: relative; height: 14px; margin: 2px 9px 0; }   /* отметки событий под ползунком, по ширине его дорожки */
.tm-ev { position: absolute; top: 0; width: 8px; height: 14px; margin-left: -4px; padding: 0; border: 0; border-radius: 3px;
  background: var(--c); cursor: pointer; opacity: .9; }
.tm-ev.many { width: 16px; margin-left: -8px; color: #fff; font: 700 9px/12px var(--font, inherit); text-align: center; }
.tm-ev:hover, .tm-ev:focus-visible { opacity: 1; transform: scaleY(1.25); outline: 2px solid var(--text); outline-offset: 1px; }
.tm-tip { position: absolute; z-index: 2; max-width: min(380px, calc(100% - 16px)); padding: 7px 10px; border-radius: 8px; pointer-events: none;
  background: var(--bg); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0,0,0,.35); font-size: 12px; line-height: 1.45; }
.tm-tip div { display: flex; gap: 6px; align-items: baseline; }
.tm-tip i { flex: none; width: 8px; height: 8px; border-radius: 2px; transform: translateY(1px); }
.tm-tip b { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.tm-ends { display: flex; justify-content: space-between; gap: 8px; }
.tm-ctrl { display: flex; gap: 8px; margin: 8px 0; }
.tm-ctrl .btn { flex: 1; padding-left: 6px; padding-right: 6px; }
#tm-play { flex: 2; }
#tm-live.on { border-color: var(--accent); color: var(--accent); }
.tm-speed { margin: 0; }
[data-theme=light] .tm { box-shadow: 0 8px 28px rgba(15, 23, 42, .16); border-color: transparent; }
@media (min-width: 821px) { body:not(.sb-collapsed) .tm { left: calc(50% + 208px); width: min(520px, calc(100% - 460px)); } }
@media (max-width: 820px) {
  .tm { top: 56px; bottom: auto; padding: 8px 10px 10px; } .tm-speed { display: none; }
  .tm-on .leaflet-left .leaflet-control, .tm-on .riskbar { display: none; }     /* панель на их месте; закрыть — ✕ */
}
/* [машина-времени] конец */
/* досье: санкции компании и ссылки [data-docked] начало */
.dos-sanc { margin-left: 6px; color: #e5484d; font-weight: 600; font-size: 12px; }
.dos-sanc a { color: inherit; }
.dos .dos-links, .dos li .dos-links { display: block; font-weight: 400; margin-top: 2px; }
/* [data-docked] конец */

/* подсказки «?» к статусам и событиям */
.hint-q { display: inline-grid; place-items: center; width: 15px; height: 15px; margin-left: 4px; border-radius: 50%; vertical-align: 1px;
  border: 1px solid var(--line); color: var(--muted); font: 700 10px/1 var(--font, inherit); cursor: help; user-select: none; }
.hint-q:hover, .hint-q:focus-visible { color: var(--text); border-color: var(--accent); outline: none; }
.hint-tip { position: fixed; z-index: 6000; max-width: min(320px, calc(100vw - 16px)); padding: 8px 10px; border-radius: 8px; pointer-events: none;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.35);
  font: 400 12.5px/1.45 var(--font, inherit); text-transform: none; letter-spacing: 0; }
.tm-tip small { display: block; margin-top: 1px; }
.sc-grid span.hint-q, .sc-grid span .hint-q { display: inline-grid; width: 13px; height: 13px; font-size: 9px; margin-left: 3px; vertical-align: 0; }   /* «?» у подписи поля, а не в значении — не переносится */

/* ---------- лаборатория 0.9 [лаборатория] начало ---------- */
.lab-bar { position: fixed; z-index: 1200; left: 50%; transform: translateX(-50%); bottom: 34px; display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; border-radius: 999px; background: var(--bg-2); border: 1px solid #7c3aed; box-shadow: 0 6px 20px rgba(0,0,0,.3); font-size: 13px; white-space: nowrap; }
.lab-bar .btn { padding: 4px 10px; }
.lab-bar label { display: inline-flex; align-items: center; gap: 4px; }
.lab.tm-on .lab-bar { display: none; }
.lab-pred { margin: 0 12px 8px; padding: 8px 10px; border-radius: 6px; border: 1px solid rgba(124,58,237,.55); background: rgba(124,58,237,.08); font-size: 12.5px; line-height: 1.45; }
.lab-pred > b { display: block; margin-bottom: 2px; }
.lab-routes { list-style: none; padding: 0; margin: 6px 0 4px; }
.lab-routes li { display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.lab-routes li i { flex: none; width: 14px; height: 4px; border-radius: 2px; transform: translateY(-2px); }
.lab-routes li.best { font-weight: 600; }
.lab-routes li.best .muted { font-weight: 400; }
.lab-zones { margin: 6px 0 2px; }
.lab-red { color: #dc2626; }
.lab-ok { color: var(--green, #16a34a); }
.lab-dr { color: #7c3aed; }
.lab-fleet { position: absolute; z-index: 1100; right: 12px; top: 64px; width: min(560px, calc(100% - 24px)); max-height: calc(100% - 140px); overflow: auto;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
/* открыта карточка судна (она справа, 320px) — таблица встаёт левее, чтобы не закрывать карточку */
body:has(#ship-panel:not([hidden])) .lab-fleet { right: 344px; width: min(560px, calc(100% - 356px)); }
.lab-fleet-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.lab-table { width: 100%; border-collapse: collapse; }
.lab-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--line); }
.lab-table td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lab-table tr[data-mmsi] { cursor: pointer; }
.lab-table tr[data-mmsi]:hover { background: var(--bg); }
@media (max-width: 820px) { .lab-bar { bottom: auto; top: 56px; font-size: 12px; gap: 6px; padding: 4px 8px; } .lab-bar .muted { display: none; } }
.lab-methods { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.lab-methods button { font: inherit; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; cursor: pointer; color: inherit;
  background: transparent; border: 1px solid var(--mc); }
.lab-methods button.on { background: var(--mc); color: #fff; font-weight: 600; }
.lab-mhint { margin-bottom: 4px; }
.lab-guess, .lab-dlog { margin-top: 6px; }
.lab-dlog summary { cursor: pointer; }
.lab-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
#lab-acc { width: min(820px, calc(100% - 24px)); }
.lab-acc td.lab-best { font-weight: 700; color: var(--green, #16a34a); }
.lab-acc th { font-size: 11.5px; }
.lab-paid-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 4px; font-size: 14px; }
.lab-paid-h .btn { margin-left: auto; padding: 4px 10px; }
.lab-sum { margin: 6px 0 4px; padding: 6px 8px; border-radius: 6px; background: var(--bg-2, rgba(255,255,255,.06)); border: 1px solid var(--line); line-height: 1.5; }
.lab-sum > div + div { margin-top: 2px; }
.lab-h { margin: 10px 0 2px; font-weight: 600; }
.lab-h .muted { font-weight: 400; font-size: 11.5px; }
.lab-legend { margin-top: 2px; }
.lab-more { margin-top: 8px; }
.lab-more summary, .lab-zones summary { cursor: pointer; }
.lab-more > div { margin-top: 3px; }
.lab-stat { margin: 2px 0 0; padding-left: 18px; }
.lab-foot { margin-top: 8px; }
#lab-acc .lab-h { font-size: 13.5px; margin-top: 14px; }
#lab-acc p.muted { margin: 2px 0 6px; }
/* [лаборатория] конец */

/* учётка только для просмотра (демо): всё, что меняет данные, скрыто — сервер такие запросы всё равно отклоняет */
body.readonly #btn-fleet-new, body.readonly #btn-add-toggle, body.readonly #btn-share-toggle, body.readonly #add-vessel,
body.readonly #fleet-share, body.readonly #fleet-foot-owner, body.readonly #fleet-foot-guest, body.readonly .vessel-del,
body.readonly #btn-rule-new, body.readonly #rule-presets, body.readonly #btn-rules-defaults, body.readonly .ri-actions,
body.readonly #btn-area-draw, body.readonly .ar-del, body.readonly [data-add-fleet], body.readonly .sc-fleet { display: none !important; }
body.readonly .ri-toggle { pointer-events: none; opacity: .5; }

/* проверка со спутника [data-docked] */
.sat-scope { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.sat-count { margin: 10px 0; }
#sat-result { margin-top: 12px; }
#sat-result .sat-row { cursor: pointer; }
#sat-result .sat-row:hover td { background: var(--hover, rgba(127,127,127,.08)); }
.sc-pane[data-pane="dossier"] > .sc-comp { margin-bottom: 10px; }
/* история происшествий во вкладке «Досье» */
/* те же отступы и заголовок, что у разделов досье над ним */
.cas { padding: 12px 12px 16px; border-top: 1px solid var(--line); font-size: 12.5px; }
.cas:empty { display: none; }
.cas-h { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.cas-list { margin: 0 0 8px; padding-left: 16px; line-height: 1.5; }
.cas-list li { margin: 2px 0; }
.cas p { margin: 6px 0; }
.cas .sc-row { margin-top: 10px; }

/* ---------- загрузка: кораблик одним цветом, за ним проявляется подпись ---------- */
.sail { position: relative; display: block; padding-bottom: 6px; line-height: 1.35; overflow: hidden; }   /* кораблик не выходит за рамку */
.sail-text { display: block; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  clip-path: inset(0 100% 0 0); animation: sail-reveal 3.2s linear infinite; }
.sail-ship { position: absolute; bottom: 2px; left: -22px; line-height: 0; animation: sail-go 3.2s linear infinite; }
.sail-ship svg { display: block; animation: sail-bob 1s steps(2) infinite; }
.sail-smoke { animation: sail-smoke 1s steps(2) infinite; }
/* волны — пиксельная линия тем же цветом */
.sail-sea { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: currentColor; opacity: .45;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='3' shape-rendering='crispEdges'%3E%3Cpath d='M0 1h1v1H0zM1 0h2v1H1zM3 1h1v1H3zM4 2h3v1H4zM7 1h1v1H7z'/%3E%3C/svg%3E") repeat-x 0 0 / 8px 3px;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='3' shape-rendering='crispEdges'%3E%3Cpath d='M0 1h1v1H0zM1 0h2v1H1zM3 1h1v1H3zM4 2h3v1H4zM7 1h1v1H7z'/%3E%3C/svg%3E") repeat-x 0 0 / 8px 3px;
  clip-path: inset(0 100% 0 0); animation: sail-wake 3.2s linear infinite, sail-waves 1s steps(2) infinite; }
/* кораблик проходит путь за 80 % цикла, подпись открывается за его кормой, потом гаснет и всё сначала */
@keyframes sail-go { 0% { left: -22px; } 80%, 100% { left: 100%; } }
@keyframes sail-reveal { 0% { clip-path: inset(0 100% 0 0); opacity: 1; } 80% { clip-path: inset(0 0 0 0); opacity: 1; }
  92% { opacity: 1; } 100% { clip-path: inset(0 0 0 0); opacity: 0; } }
@keyframes sail-wake { 0% { clip-path: inset(0 100% 0 0); opacity: .45; } 80% { clip-path: inset(0 0 0 0); opacity: .45; }
  92% { opacity: .45; } 100% { clip-path: inset(0 0 0 0); opacity: 0; } }   /* волны остаются за кормой, как след */
@keyframes sail-bob { 50% { transform: translateY(1px); } }
@keyframes sail-smoke { 50% { opacity: .4; } }
@keyframes sail-waves { 50% { -webkit-mask-position: 2px 0; mask-position: 2px 0; } }

/* заглушка «загружается» в карточках и окнах */
.ship-loader { color: var(--accent); font-size: 12.5px; font-weight: 600; padding: 12px 0; }
.ship-loader .sail { width: min(260px, 100%); margin: 0 auto; }
.ship-loader.small { padding: 4px 0; }
.ship-loader.small .sail { width: min(200px, 100%); }

/* кнопка в работе: вдавлена, размер прежний, вместо подписи — кораблик */
.btn.is-busy, .btn.is-busy:disabled { position: relative; overflow: hidden; opacity: 1; cursor: progress; padding-top: 5px; padding-bottom: 4px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .22); }
.btn.is-busy .sail { min-width: 120px; }

@media (prefers-reduced-motion: reduce) {
  .sail-text { clip-path: none; animation: none; }
  .sail-ship { left: calc(50% - 11px); bottom: -12px; animation: none; opacity: 0; }
  .sail-ship svg, .sail-smoke { animation: none; }
  .sail-sea { animation: none; clip-path: none; }
}
