:root {
  --ink: #10202c;
  --muted: #61707d;
  --panel: rgba(255, 255, 255, 0.94);
  --line: rgba(16, 32, 44, 0.12);
  --live: #12a66a;
  --stale: #e2a126;
  --nofix: #d24f45;
  --offline: #7b8792;
  --water: #d8edf2;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow-x: hidden;
}

body {
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef3f4;
  letter-spacing: 0;
}

button {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  min-height: 640px;
  overflow-x: hidden;
}

.shell.side-collapsed {
  grid-template-columns: minmax(0, 1fr) 0;
}

.shell.side-collapsed .side-panel {
  display: none;
}

.side-panel,
.show-panel-btn {
  display: none !important;
}

.map-panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: var(--water);
}

.map-panel:fullscreen {
  width: 100vw;
  height: 100vh;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 0;
}

.topbar {
  position: absolute;
  top: 12px;
  left: 16px;
  right: 16px;
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.topbar > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.topbar h1,
.side-header h2,
.detail-title h3 {
  margin: 0;
  line-height: 1.05;
}

.topbar h1 {
  font-size: 31px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 5px;
  color: #315064;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 0 1 auto;
  justify-content: flex-end;
  max-width: min(560px, 100%);
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 38px rgba(17, 34, 46, 0.16);
  backdrop-filter: blur(14px);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}

.icon-btn.active,
.icon-btn:hover {
  color: #fff;
  background: #17394c;
}

.alerting-btn {
  color: #fff;
  background: #0f766e;
}

.alerting-btn:hover {
  background: #0d9488;
}

.cyclone-layer-btn {
  gap: 5px;
}

.cyclone-layer-btn b {
  display: inline-flex;
  min-width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: #475569;
  font-size: 10px;
}

.cyclone-layer-btn.has-wni {
  color: #fff;
  background: #b91c1c;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.18);
}

.cyclone-layer-btn.has-wni b {
  background: #fff;
  color: #991b1b;
}

.cyclone-layer-btn.feed-error {
  background: #9a3412;
}

.cyclone-marker-wrap {
  background: transparent;
  border: 0;
}

.cyclone-map-marker {
  position: relative;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: var(--cyclone-color, #ef4444);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--cyclone-color, #ef4444) 30%, transparent), 0 8px 20px rgba(15, 23, 42, 0.35);
}

.cyclone-map-marker::before,
.cyclone-map-marker::after {
  position: absolute;
  width: 17px;
  height: 7px;
  border: 3px solid currentColor;
  border-right: 0;
  border-bottom: 0;
  border-radius: 100% 0 0;
  content: '';
}

.cyclone-map-marker::before {
  top: 8px;
  left: 6px;
  transform: rotate(18deg);
}

.cyclone-map-marker::after {
  right: 6px;
  bottom: 8px;
  transform: rotate(198deg);
}

.cyclone-map-marker span {
  font-size: 12px;
  font-weight: 950;
}

.cyclone-map-marker b {
  position: absolute;
  right: -10px;
  bottom: -8px;
  max-width: 52px;
  overflow: hidden;
  padding: 3px 6px;
  border: 1px solid rgba(255,255,255,0.85);
  border-radius: 9px;
  color: #fff;
  background: #0f172a;
  font-size: 8px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cyclone-leaflet-popup .leaflet-popup-content-wrapper,
.cyclone-leaflet-popup .leaflet-popup-tip {
  color: #e2e8f0;
  background: #071827;
}

.cyclone-leaflet-popup .leaflet-popup-content {
  margin: 12px 14px;
}

.cyclone-popup-card {
  min-width: 250px;
}

.cyclone-popup-card header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(148,163,184,0.2);
}

.cyclone-popup-card header > span {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #dc2626;
  font-weight: 900;
}

.cyclone-popup-card header div {
  display: grid;
  gap: 2px;
}

.cyclone-popup-card header strong {
  color: #fff;
  font-size: 14px;
}

.cyclone-popup-card header small {
  color: #94a3b8;
  font-size: 10px;
}

.cyclone-popup-card dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 14px;
  margin: 10px 0;
}

.cyclone-popup-card dt {
  color: #94a3b8;
}

.cyclone-popup-card dd {
  margin: 0;
  color: #f8fafc;
  text-align: right;
  font-weight: 800;
}

.cyclone-popup-card dd.cyclone-report-old {
  color: #fbbf24;
}

.cyclone-report-warning {
  display: grid;
  gap: 3px;
  margin: 9px 0;
  padding: 8px 9px;
  border: 1px solid rgba(251, 191, 36, 0.55);
  border-left: 4px solid #f59e0b;
  border-radius: 6px;
  background: rgba(146, 64, 14, 0.2);
}

.cyclone-report-warning b {
  color: #fde68a;
  font-size: 10px;
}

.cyclone-report-warning span {
  color: #cbd5e1;
  font-size: 9px;
  line-height: 1.35;
}

.cyclone-zone-key {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0 10px;
}

.cyclone-zone-key span {
  padding: 4px 7px;
  border: 1px solid currentColor;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
}

.cyclone-zone-key .zone-red { color: #f87171; }
.cyclone-zone-key .zone-yellow { color: #fde047; }
.cyclone-zone-key .zone-green { color: #4ade80; }

.cyclone-guidance {
  margin: 9px 0 10px;
  padding: 9px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 6px;
  background: rgba(14, 116, 144, 0.13);
}

.cyclone-guidance > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cyclone-guidance b { color: #7dd3fc; }
.cyclone-guidance span { color: #a7f3d0; font-size: 10px; font-weight: 800; }
.cyclone-guidance dl { margin: 7px 0; }
.cyclone-guidance p { margin: 7px 0 0; color: #cbd5e1; font-size: 10px; line-height: 1.45; }

.cyclone-guidance.cyclone-guidance-archived {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(120, 53, 15, 0.18);
}

.cyclone-guidance.cyclone-guidance-archived b,
.cyclone-guidance.cyclone-guidance-archived span {
  color: #fcd34d;
}

.cyclone-popup-card a {
  display: block;
  padding: 7px 9px;
  border-radius: 6px;
  color: #fff;
  background: #0f766e;
  text-align: center;
  text-decoration: none;
  font-weight: 800;
}

.measure-tool-btn {
  gap: 6px;
}

.measure-tool-btn.active {
  color: #fff;
  background: #0f766e;
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.2);
}

.measure-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.measure-panel {
  position: absolute;
  top: 86px;
  left: 200px;
  z-index: 690;
  width: min(352px, calc(100vw - 24px));
  max-height: calc(100vh - 112px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(14, 116, 144, 0.22);
  border-radius: 10px;
  color: #10202c;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 44px rgba(17, 34, 46, 0.22);
  backdrop-filter: blur(16px);
}

.measure-panel.hidden {
  display: none;
}

.range-ring-panel {
  position: absolute;
  top: 86px;
  left: 564px;
  z-index: 688;
  width: min(286px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(14, 116, 144, 0.22);
  border-radius: 10px;
  color: #10202c;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 44px rgba(17, 34, 46, 0.22);
  backdrop-filter: blur(16px);
}

.range-ring-panel.hidden {
  display: none;
}

.range-ring-btn.active {
  color: #fff;
  background: #0f766e;
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.18);
}

.zones-btn.active {
  color: #07151d;
  background: #f9c74f;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.22);
}

.zones-panel {
  position: absolute;
  top: 86px;
  left: 862px;
  z-index: 689;
  width: min(360px, calc(100vw - 24px));
  max-height: calc(100vh - 112px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(245, 158, 11, 0.36);
  border-radius: 8px;
  color: #10202c;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 44px rgba(17, 34, 46, 0.2);
  backdrop-filter: blur(16px);
}

.zones-panel.hidden {
  display: none;
}

.zone-toggle-list {
  display: grid;
  gap: 7px;
}

.zone-toggle {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  align-items: center;
  min-height: 46px;
  padding: 8px;
  border: 1px solid rgba(14, 116, 144, 0.16);
  border-radius: 8px;
  background: rgba(239, 248, 250, 0.8);
  cursor: pointer;
}

.zone-toggle input {
  width: 17px;
  height: 17px;
  accent-color: #0f766e;
}

.zone-toggle strong {
  display: block;
  color: #0f2430;
  font-size: 12px;
  line-height: 1.15;
}

.zone-toggle small {
  display: block;
  margin-top: 2px;
  color: #5f7482;
  font-size: 11px;
  line-height: 1.25;
}

.zone-toggle.marpol {
  border-left: 4px solid #0ea5e9;
}

.zone-toggle.eca {
  border-left: 4px solid #f59e0b;
}

.zone-toggle.eca-upcoming {
  border-left: 4px dashed #0891b2;
}

.zone-toggle.eca-domestic {
  border-left: 4px solid #15803d;
}

.zone-filter-field {
  display: grid;
  gap: 5px;
  color: #4b6473;
  font-size: 11px;
  font-weight: 900;
}

.zone-filter-field select {
  width: 100%;
  min-height: 36px;
  padding: 0 34px 0 10px;
  border: 1px solid rgba(14, 116, 144, 0.24);
  border-radius: 6px;
  color: #0f2430;
  background: #fff;
  font: inherit;
  font-size: 12px;
}

.zone-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.zone-actions .icon-btn {
  min-height: 34px;
  color: #fff;
  background: #0f766e;
}

.zone-dataset-status {
  min-width: 0;
  color: #526b7a;
  font-size: 10px;
  line-height: 1.3;
}

.zone-dataset-status.error {
  color: #b91c1c;
  font-weight: 900;
}

.zone-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  min-height: 26px;
  padding: 5px 8px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 6px;
  color: #526b7a;
  background: rgba(248, 250, 252, 0.82);
  font-size: 10px;
  font-weight: 900;
}

.zone-legend span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.zone-swatch {
  width: 22px;
  height: 9px;
  border-radius: 2px;
}

.zone-swatch.active {
  border: 2px solid #d97706;
  background: rgba(245, 158, 11, 0.2);
}

.zone-swatch.upcoming {
  height: 0;
  border-top: 2px dashed #0891b2;
}

.zone-swatch.domestic {
  border: 2px dashed #15803d;
  background: rgba(34, 197, 94, 0.16);
}

.zone-fleet-status {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(14, 116, 144, 0.14);
  border-radius: 6px;
  background: rgba(236, 254, 255, 0.7);
}

.zone-fleet-status > strong {
  color: #0f2430;
  font-size: 11px;
}

.zone-fleet-status-list {
  display: grid;
  gap: 4px;
}

.zone-fleet-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-height: 24px;
  color: #536879;
  font-size: 10px;
}

.zone-fleet-code {
  display: grid;
  place-items: center;
  min-height: 22px;
  border-radius: 4px;
  color: #fff;
  background: #1f4f64;
  font-weight: 900;
}

.zone-fleet-row.inside {
  color: #8a4b05;
  font-weight: 900;
}

.zone-fleet-row.inside.domestic {
  color: #166534;
}

.zone-toggle.pssa {
  border-left: 4px solid #22c55e;
}

.zone-toggle.security {
  border-left: 4px solid #ef4444;
}

.zone-source-box {
  padding: 8px;
  border-radius: 6px;
  color: #405463;
  background: rgba(15, 23, 42, 0.06);
  font-size: 11px;
  line-height: 1.35;
}

.zone-source-box strong {
  display: block;
  margin-bottom: 3px;
  color: #0f2430;
}

.zone-source-box small {
  display: block;
  margin-top: 5px;
  color: #6b7e8a;
  font-size: 10px;
}

.zone-popup {
  display: grid;
  gap: 6px;
  min-width: 220px;
  color: #0f2430;
  font-size: 12px;
}

.zone-popup strong {
  color: #03131d;
  font-size: 14px;
}

.zone-popup .zone-popup-status {
  justify-self: start;
  padding: 3px 6px;
  border-radius: 4px;
  color: #7c4700;
  background: rgba(245, 158, 11, 0.18);
  font-size: 10px;
  font-weight: 900;
}

.zone-popup .zone-popup-status.upcoming {
  color: #075985;
  background: rgba(8, 145, 178, 0.14);
}

.zone-popup .zone-popup-status.domestic {
  color: #166534;
  background: rgba(34, 197, 94, 0.15);
}

.zone-popup small,
.zone-popup em,
.zone-popup p {
  margin: 0;
  color: #536879;
  font-style: normal;
  line-height: 1.35;
}

.zone-popup dl {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 3px 7px;
  margin: 0;
}

.zone-popup dt {
  color: #647987;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.zone-popup dd {
  margin: 0;
  color: #173442;
  font-size: 11px;
  font-weight: 800;
}

.zone-popup a {
  color: #0e7490;
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
}

.cyclone-popup-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.cyclone-popup-actions .guidance-pdf-link {
  background: #0369a1;
}

@media (max-width: 520px) {
  .cyclone-popup-actions { grid-template-columns: 1fr; }
}

.zone-label {
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  color: #07151d;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.range-ring-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(14, 116, 144, 0.18);
  border-radius: 8px;
  color: #315064;
  background: rgba(216, 237, 242, 0.46);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.range-ring-check input {
  width: 16px;
  height: 16px;
  accent-color: #0f766e;
}

.range-ring-preview {
  padding: 8px 9px;
  border: 1px solid rgba(14, 116, 144, 0.16);
  border-radius: 9px;
  color: #0f766e;
  background: linear-gradient(180deg, rgba(216, 237, 242, 0.58), rgba(255, 255, 255, 0.86));
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
}

.range-ring-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.range-ring-path {
  filter: drop-shadow(0 0 4px rgba(20, 184, 166, 0.2));
}

.range-ring-label {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid var(--ring-color, #0f766e);
  border-radius: 999px;
  color: #071607;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 16px rgba(17, 34, 46, 0.16);
  font-size: 10px;
  font-weight: 1000;
  line-height: 1;
  white-space: nowrap;
}

.measure-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.measure-head h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.05;
}

.measure-close {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #17394c;
  background: #eef6f8;
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
}

.measure-hint {
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
  color: #315064;
  background: rgba(216, 237, 242, 0.72);
  font-size: 11px;
  font-weight: 700;
}

.measure-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.measure-start-label {
  grid-column: 1 / -1;
}

.measure-inputs label {
  display: grid;
  gap: 3px;
  color: #315064;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.measure-inputs input {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(14, 116, 144, 0.22);
  border-radius: 8px;
  color: #10202c;
  background: #f8fbfc;
  font-size: 14px;
  font-weight: 900;
}

.measure-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.measure-summary div {
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(14, 116, 144, 0.16);
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(216, 237, 242, 0.58), rgba(255, 255, 255, 0.86));
}

.measure-summary span {
  display: block;
  color: #61707d;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.measure-summary strong {
  display: block;
  margin-top: 3px;
  color: #0f766e;
  font-size: 16px;
  line-height: 1.05;
}

.measure-eta-value {
  font-size: 14px !important;
}

.measure-table-wrap {
  overflow: auto;
  max-height: 148px;
  border: 1px solid rgba(14, 116, 144, 0.16);
  border-radius: 9px;
}

.measure-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
}

.measure-table th,
.measure-table td {
  padding: 5px 6px;
  border-bottom: 1px solid rgba(14, 116, 144, 0.14);
  text-align: left;
  vertical-align: top;
}

.measure-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #315064;
  background: #eef6f8;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.measure-table tr:last-child td {
  border-bottom: 0;
}

.measure-row-btn {
  min-width: 34px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid rgba(244, 63, 94, 0.34);
  border-radius: 6px;
  color: #be123c;
  background: rgba(255, 228, 230, 0.88);
  cursor: pointer;
  font-size: 10px;
  font-weight: 900;
}

.measure-row-btn:hover {
  color: #fff;
  background: #be123c;
}

.measure-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.measure-actions .icon-btn {
  width: 100%;
  min-width: 0;
  min-height: 31px;
  padding: 0 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  font-size: 12px;
}

.measure-actions .icon-btn.active {
  color: #fff;
  border-color: #0f766e;
  background: #0f766e;
}

.measure-marker {
  width: 24px;
  height: 24px;
  border: 2px solid #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: #0f766e;
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.38);
  font-size: 11px;
  font-weight: 900;
}

.measure-leg-label {
  display: block;
  border: 1px solid rgba(14, 116, 144, 0.28);
  padding: 3px 6px;
  border-radius: 7px;
  color: #10202c;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 14px rgba(17, 34, 46, 0.16);
  cursor: copy;
  font-family: inherit;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.measure-marker {
  cursor: grab;
}

.leaflet-drag-target .measure-marker {
  cursor: grabbing;
}

body.measure-active #map {
  cursor: crosshair;
}

.topbar.compact-bar {
  top: 12px;
  right: auto;
  bottom: auto;
  left: 12px;
  display: flex;
  width: 176px;
  max-width: none;
  max-height: calc(100vh - 28px);
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
  gap: 7px;
  overflow: auto;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(246, 249, 249, 0.9);
  box-shadow: 0 14px 38px rgba(17, 34, 46, 0.16);
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.topbar.compact-bar > .compact-brand {
  grid-area: brand;
  order: 1;
  flex: 0 0 auto;
}

.topbar.compact-bar > .replay-launch {
  order: 2;
  flex: 0 0 auto;
}

.topbar.compact-bar > .track-controls {
  grid-area: track;
  order: 3;
  flex: 0 0 auto;
}

.topbar.compact-bar > .top-actions {
  grid-area: actions;
  order: 4;
  flex: 0 0 auto;
}

.compact-brand {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 2px 2px 6px;
  color: #17394c;
  white-space: nowrap;
}

.compact-brand strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 25px;
  border-radius: 6px;
  color: #fff;
  background: #17394c;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.compact-brand span {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.replay-launch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 8px;
  min-height: 39px;
  padding: 6px 28px 6px 9px;
  overflow: hidden;
  color: #f7ffff;
  text-decoration: none;
  background: #0d6e86;
  border: 1px solid #10bde5;
  border-radius: 7px;
  box-shadow: 0 6px 16px rgba(13, 110, 134, .2);
}

.replay-launch::after {
  content: '\2192';
  position: absolute;
  right: 9px;
  color: #8ff0ff;
  font-size: 18px;
  font-weight: 900;
}

.replay-launch strong,
.replay-launch small { display: block; min-width: 0; }
.replay-launch strong { font-size: 11px; line-height: 1.1; }
.replay-launch small { grid-column: 1; color: #bdeef6; font-size: 8px; font-weight: 700; }
.replay-launch:hover { background: #09566b; border-color: #76ebff; transform: translateY(-1px); }

.topbar.compact-bar .top-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-content: stretch;
  gap: 5px;
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.topbar.compact-bar .icon-btn,
.topbar.compact-bar .track-btn {
  min-width: 0;
  width: 100%;
  height: 29px;
  padding: 0 5px;
  border-radius: 6px;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.topbar.compact-bar .measure-tool-btn {
  gap: 3px;
}

.topbar.compact-bar .measure-icon {
  width: 13px;
  height: 13px;
}

.topbar.compact-bar .smc-chrome,
.topbar.compact-bar .smc-chrome-chip,
.topbar.compact-bar .smc-chrome-btn,
.topbar.compact-bar #smcChromeThemeBtn,
.topbar.compact-bar #smcChromeWeather,
.topbar.compact-bar #smcChromeOnlineBtn,
.topbar.compact-bar #smcChromeServer,
.topbar.compact-bar #smcChromeNet,
#smcChromeThemePanel,
#smcChromeOnlinePanel {
  display: none !important;
}

.track-controls {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 5px;
  min-width: 0;
}

.compact-presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 0;
}

.bar-divider {
  width: 1px;
  height: 28px;
  margin: 0 2px;
  background: rgba(132, 151, 160, 0.5);
}

.floating-toggle {
  position: absolute;
  right: 16px;
  z-index: 720;
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #fff;
  background: #17394c;
  box-shadow: 0 14px 34px rgba(17, 34, 46, 0.18);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.show-controls-btn {
  top: 12px;
}

.show-panel-btn {
  top: 56px;
}

body.clean-map .topbar,
body.clean-map .track-toolbar,
body.clean-map .legend,
body.clean-map .leaflet-top.leaflet-right {
  display: none;
}

body.clean-map .show-controls-btn,
.shell.side-collapsed .show-panel-btn {
  display: inline-flex;
}

.track-toolbar {
  position: absolute;
  top: 70px;
  left: 16px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  max-width: min(420px, calc(100% - 32px));
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 38px rgba(17, 34, 46, 0.14);
  backdrop-filter: blur(14px);
}

.track-presets {
  display: flex;
  min-width: 0;
  gap: 6px;
  align-items: center;
}

.track-btn {
  height: 30px;
  min-width: 44px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: #eef4f4;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.track-btn.active,
.track-btn:hover {
  color: #fff;
  background: #17394c;
}

.track-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  min-width: 82px;
  white-space: nowrap;
}

.meteo-canvas {
  pointer-events: none;
  mix-blend-mode: multiply;
}

.legend {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  box-shadow: 0 14px 38px rgba(17, 34, 46, 0.14);
}

.speed-color-panel {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 500;
  display: grid;
  gap: 6px;
  min-width: 176px;
  padding: 10px 11px;
  border: 1px solid rgba(125, 211, 252, 0.32);
  border-radius: 9px;
  background: rgba(5, 16, 30, 0.9);
  color: #f8fafc;
  box-shadow: 0 14px 38px rgba(2, 6, 23, 0.34);
  backdrop-filter: blur(14px);
  transform: none;
  pointer-events: none;
}

.speed-color-panel strong {
  margin-bottom: 2px;
  color: #e0f2fe;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.speed-color-panel strong small {
  color: #7dd3fc;
  font-size: 9px;
}

.speed-color-panel span {
  display: grid;
  grid-template-columns: 28px 54px 1fr;
  gap: 6px;
  align-items: center;
  color: #dbeafe;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.speed-color-panel span b {
  color: #f8fafc;
  font-size: 11px;
}

.speed-color-panel span em {
  color: #93c5d8;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: right;
  text-transform: uppercase;
}

.speed-key {
  display: inline-block;
  width: 28px;
  height: 10px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32), 0 0 8px color-mix(in srgb, currentColor 55%, transparent);
}

.speed-stop { color: #111827; background: #111827; }
.speed-slow { color: #7c3f16; background: #7c3f16; }
.speed-3 { color: #ff3157; background: #ff3157; }
.speed-5 { color: #ff7a1a; background: #ff7a1a; }
.speed-8 { color: #ffd43b; background: #ffd43b; }
.speed-105 { color: #a8e63d; background: #a8e63d; }
.speed-125 { color: #39e75f; background: #39e75f; }
.speed-14 { color: #00c896; background: #00c896; }

.fleet-ticker {
  position: absolute;
  left: 224px;
  right: 16px;
  bottom: 14px;
  z-index: 510;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 6px 8px;
  border: 1px solid rgba(16, 32, 44, 0.22);
  border-radius: 9px;
  color: #eaf7ff;
  background: linear-gradient(90deg, rgba(8, 25, 39, 0.94), rgba(12, 39, 56, 0.82));
  box-shadow: 0 16px 38px rgba(6, 20, 31, 0.28);
  backdrop-filter: blur(14px);
  overflow: hidden;
  pointer-events: auto;
}

.fleet-ticker-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  color: #10202c;
  background: #7dfad0;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.fleet-ticker-window {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.fleet-ticker-window::before,
.fleet-ticker-window::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: 34px;
  pointer-events: none;
}

.fleet-ticker-window::before {
  left: 0;
  background: linear-gradient(90deg, rgba(8, 25, 39, 0.96), rgba(8, 25, 39, 0));
}

.fleet-ticker-window::after {
  right: 0;
  background: linear-gradient(270deg, rgba(12, 39, 56, 0.88), rgba(12, 39, 56, 0));
}

.fleet-ticker-track {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  min-width: max-content;
  white-space: nowrap;
  will-change: transform;
  animation: fleetTickerScroll var(--ticker-duration, 44s) linear infinite;
}

.fleet-ticker:hover .fleet-ticker-track {
  animation-play-state: paused;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #dff7ff;
  font-size: 12px;
  font-weight: 800;
}

.ticker-item strong {
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.ticker-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  color: #061723;
  background: var(--ticker-color, #7dfad0);
  font-size: 11px;
  font-weight: 950;
}

.ticker-status {
  color: #7dfad0;
  text-transform: uppercase;
}

.ticker-status.stale {
  color: #ffd166;
}

.ticker-status.offline,
.ticker-status.no_fix {
  color: #ff7a70;
}

.ticker-muted {
  color: #8fb2c6;
}

.ticker-sep {
  color: rgba(180, 218, 232, 0.48);
}

.ticker-empty {
  color: #a9c1cf;
  font-size: 12px;
  font-weight: 800;
}

.tv-mode-panel {
  position: absolute;
  top: 18px;
  left: 22px;
  right: 22px;
  z-index: 640;
  display: none;
  color: #ecfbff;
  pointer-events: none;
}

.tv-mode-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  padding: 10px 12px 10px 16px;
  border: 1px solid rgba(98, 226, 255, 0.28);
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(5, 18, 31, 0.92), rgba(9, 42, 58, 0.78));
  box-shadow: 0 18px 44px rgba(4, 16, 28, 0.34);
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.tv-mode-head span {
  display: block;
  color: #74e8ff;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.tv-mode-head strong {
  display: block;
  margin-top: 2px;
  color: #fff;
  font-size: 28px;
  font-weight: 950;
  letter-spacing: 0.06em;
}

.tv-mode-actions {
  display: flex;
  gap: 8px;
}

.tv-mode-actions button {
  height: 36px;
  padding: 0 13px;
  border: 1px solid rgba(125, 250, 208, 0.56);
  border-radius: 8px;
  color: #eafff8;
  background: rgba(4, 38, 45, 0.72);
  cursor: pointer;
  font-size: 12px;
  font-weight: 950;
}

.tv-mode-actions button:hover {
  background: rgba(14, 116, 144, 0.86);
}

.tv-vessel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  margin-top: 12px;
  pointer-events: none;
}

.tv-vessel-card {
  min-width: 0;
  min-height: 138px;
  padding: 14px;
  border: 1px solid rgba(98, 226, 255, 0.22);
  border-left: 6px solid var(--tv-color, #28d0ff);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(4, 18, 32, 0.88), rgba(9, 40, 55, 0.72));
  box-shadow: 0 18px 44px rgba(4, 16, 28, 0.3);
  backdrop-filter: blur(14px);
}

.tv-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.tv-card-top h3 {
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-size: clamp(20px, 1.6vw, 30px);
  font-weight: 950;
  letter-spacing: 0.04em;
  line-height: 1.05;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.tv-card-top span {
  color: #9ebed0;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.tv-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #082019;
  background: #7dfad0;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.tv-status.stale {
  color: #2f2200;
  background: #ffd166;
}

.tv-status.offline,
.tv-status.no_fix {
  color: #fff;
  background: #ef4444;
}

.tv-metrics {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.tv-metric {
  min-width: 0;
  padding: 8px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.tv-metric span {
  display: block;
  color: #9ebed0;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tv-metric strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: #fff;
  font-size: clamp(17px, 1.55vw, 28px);
  font-weight: 950;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-card-foot {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 8px;
  margin-top: 10px;
  color: #c9e4ef;
  font-size: 12px;
  font-weight: 850;
}

.tv-card-foot span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-empty {
  grid-column: 1 / -1;
  padding: 18px;
  border: 1px dashed rgba(98, 226, 255, 0.28);
  border-radius: 12px;
  color: #c9e4ef;
  background: rgba(5, 18, 31, 0.78);
  font-weight: 900;
}

body.tv-mode .topbar,
body.tv-mode .speed-color-panel,
body.tv-mode .floating-toggle,
body.tv-mode .measure-panel,
body.tv-mode .range-ring-panel,
body.tv-mode .zones-panel,
body.tv-mode .map-vessel-panel,
body.tv-mode .alert-modal,
body.tv-mode .leaflet-top.leaflet-right,
body.tv-mode .leaflet-control-zoom {
  display: none !important;
}

body.tv-mode .tv-mode-panel {
  display: block;
}

body.tv-mode .fleet-ticker {
  top: auto;
  left: 22px;
  right: 22px;
  bottom: 18px;
  height: 56px;
  padding: 8px 10px;
  border-color: rgba(125, 250, 208, 0.38);
}

body.tv-mode .fleet-ticker-label {
  height: 36px;
  padding: 0 13px;
  font-size: 12px;
}

body.tv-mode .ticker-item {
  gap: 10px;
  font-size: 16px;
}

body.tv-mode .ticker-item strong {
  font-size: 17px;
}

body.tv-mode .ticker-code {
  min-width: 42px;
  height: 28px;
  font-size: 13px;
}

@keyframes fleetTickerScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .fleet-ticker-track {
    animation: none;
  }
}

.map-vessel-panel {
  position: absolute;
  top: 76px;
  right: 14px;
  bottom: 14px;
  z-index: 650;
  width: min(350px, calc(100vw - 28px));
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 16px;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.3);
}

.map-vessel-panel.hidden {
  display: none;
}

.map-vessel-close {
  position: sticky;
  top: 8px;
  left: calc(100% - 38px);
  z-index: 4;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: 8px 8px -38px auto;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.48);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
}

.map-vessel-close:hover {
  background: rgba(11, 22, 32, 0.82);
}

.map-vessel-panel .nav-popup-card {
  border-radius: 16px;
  background: rgba(5, 19, 28, 0.68);
}

.map-vessel-panel .nav-compass {
  height: 158px;
}

.map-vessel-panel .nav-compass svg {
  height: 158px;
}

.map-vessel-panel .nav-popup-grid {
  grid-template-columns: 108px minmax(0, 1fr);
  font-size: 12px;
}

.alert-modal {
  position: absolute;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: start center;
  padding-top: 72px;
  background: rgba(4, 14, 22, 0.28);
  backdrop-filter: blur(3px);
}

.alert-modal.hidden {
  display: none;
}

.alert-card {
  width: min(390px, calc(100vw - 24px));
  padding: 14px;
  border: 1px solid rgba(20, 184, 166, 0.48);
  border-radius: 12px;
  color: #dffbff;
  background: rgba(5, 19, 28, 0.9);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
}

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

.alert-head {
  margin-bottom: 12px;
}

.alert-head h3 {
  margin: 2px 0 0;
  color: #22d3ee;
  font-size: 21px;
}

.alert-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
}

.alert-card label {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
  color: rgba(223, 251, 255, 0.74);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.alert-card input,
.alert-card select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 8px;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.74);
  font: inherit;
  font-weight: 800;
}

.alert-card label span {
  color: rgba(223, 251, 255, 0.58);
  font-size: 10px;
}

.alert-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.alert-preview {
  margin: 4px 0 10px;
  padding: 10px;
  border: 1px solid rgba(34, 211, 238, 0.24);
  border-radius: 8px;
  background: rgba(8, 47, 73, 0.36);
}

.alert-preview span {
  display: block;
  margin-bottom: 3px;
  color: rgba(223, 251, 255, 0.58);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.alert-preview strong {
  color: #f8fafc;
  font-size: 13px;
}

.alert-active-list {
  margin: 6px 0 10px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.42);
}

.alert-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: rgba(223, 251, 255, 0.7);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.alert-section-title button,
.alert-stop-btn {
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 6px;
  color: #dffbff;
  background: rgba(8, 47, 73, 0.52);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
}

.alert-section-title button {
  padding: 4px 8px;
}

.alert-active-items {
  display: grid;
  gap: 7px;
  color: rgba(223, 251, 255, 0.62);
  font-size: 12px;
}

.alert-active-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(34, 211, 238, 0.18);
  border-radius: 7px;
  background: rgba(4, 12, 20, 0.45);
}

.alert-active-item strong {
  display: block;
  color: #f8fafc;
  font-size: 12px;
}

.alert-active-item span {
  display: block;
  margin-top: 2px;
  color: rgba(223, 251, 255, 0.58);
  font-size: 11px;
}

.alert-stop-btn {
  padding: 7px 10px;
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(127, 29, 29, 0.42);
}

.alert-stop-btn:hover {
  color: #fff;
  background: rgba(220, 38, 38, 0.72);
}

.alert-status {
  min-height: 18px;
  margin: 0 0 12px;
  color: rgba(223, 251, 255, 0.7);
  font-size: 12px;
}

.alert-status.error {
  color: #fca5a5;
}

.alert-status.ok {
  color: #86efac;
}

.meteo-legend {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 500;
  width: 220px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 38px rgba(17, 34, 46, 0.14);
}

.meteo-legend.hidden {
  display: none;
}

.meteo-legend strong {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  text-transform: uppercase;
}

.meteo-legend span {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #6bd6a5, #ffd86b, #f08a5d, #c94f7c);
}

.meteo-legend small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 50%;
}

.dot.live { background: var(--live); }
.dot.stale { background: var(--stale); }
.dot.no-fix { background: var(--nofix); }
.dot.offline { background: var(--offline); }

.line-key {
  display: inline-block;
  width: 22px;
  height: 0;
  margin-right: 6px;
  border-top: 3px solid;
  vertical-align: middle;
}

.line-key.course { border-color: #1fb66d; }
.line-key.heading { border-color: #0b1117; }

.wx-key {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 10px;
  margin-right: 6px;
  border-top: 3px solid;
  vertical-align: middle;
}

.wx-key::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -6px;
  width: 7px;
  height: 7px;
  border-top: 3px solid;
  border-right: 3px solid;
  transform: rotate(45deg);
}

.wx-key.wind,
.wx-key.wind::after { border-color: #0f9d73; }
.wx-key.current,
.wx-key.current::after { border-color: #2367d1; }
.wx-key.wave,
.wx-key.wave::after { border-color: #7a4bb0; }

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: #f8fbfb;
}

.side-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 8px;
}

.side-header h2 {
  font-size: 26px;
}

.clock {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-hide-btn {
  height: 32px;
  min-width: 58px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: #eaf0f0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.panel-hide-btn:hover {
  color: #fff;
  background: #17394c;
}

.vessel-list {
  display: grid;
  gap: 10px;
}

.vessel-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  padding: 13px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(17, 34, 46, 0.07);
}

.vessel-card:hover,
.vessel-card.selected {
  border-color: rgba(23, 57, 76, 0.42);
  box-shadow: 0 14px 30px rgba(17, 34, 46, 0.12);
}

.vessel-name {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.vessel-meta {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.metric-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mini-metric {
  padding: 8px;
  border-radius: 6px;
  background: #f1f5f5;
}

.mini-metric span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.mini-metric strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-pill.live { background: var(--live); }
.status-pill.stale { background: var(--stale); }
.status-pill.no_fix { background: var(--nofix); }
.status-pill.offline { background: var(--offline); }
.status-pill.waiting { background: #45606e; }

.detail-panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(17, 34, 46, 0.07);
}

.detail-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.detail-title h3 {
  font-size: 20px;
}

.data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 0;
}

.data-grid div {
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(16, 32, 44, 0.08);
  border-radius: 6px;
  background: #f7faf9;
}

.data-grid dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.data-grid dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 750;
}

.gps-table-panel {
  overflow: hidden;
}

.weather-panel {
  border-color: rgba(18, 102, 129, 0.2);
}

.weather-grid dd {
  font-size: 12px;
}

.weather-time {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.gps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.gps-table th,
.gps-table td {
  padding: 8px 7px;
  border-bottom: 1px solid rgba(16, 32, 44, 0.08);
  text-align: left;
  vertical-align: top;
}

.gps-table th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  background: #f1f5f5;
}

.gps-table td {
  overflow-wrap: anywhere;
}

.gps-table.compact th,
.gps-table.compact td {
  padding: 6px 7px;
}

.subhead {
  margin: 14px 0 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.raw-preview {
  max-height: 180px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid rgba(16, 32, 44, 0.1);
  border-radius: 6px;
  background: #0f202c;
  color: #d8edf2;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.ship-arrow-wrap {
  position: relative;
  width: 58px;
  height: 58px;
  filter: drop-shadow(0 2px 2px rgba(2, 6, 23, 0.82));
  transform-origin: 50% 50%;
  transition: transform 160ms ease, filter 160ms ease;
}

.ship-arrow-wrap .fleet-vessel-sprite {
  position: absolute;
  left: 0;
  top: 2px;
  width: 58px;
  height: 44px;
  overflow: visible;
  background-image: url("./assets/ais-vessels-top-view.png");
  background-repeat: no-repeat;
  background-size: 500% 500%;
  background-position: 25% 0;
  filter: drop-shadow(0 1px 1px rgba(2, 6, 23, .78));
  transform: rotate(calc(var(--course) - 90deg));
  transform-origin: 50% 50%;
  transition: opacity 140ms ease;
}

.ship-arrow {
  position: absolute;
  left: 9px;
  top: 4px;
  width: 28px;
  height: 38px;
  background: var(--ship-color);
  clip-path: polygon(50% 0, 86% 100%, 50% 82%, 14% 100%);
  transform: rotate(var(--course));
  transform-origin: 50% 58%;
}

.ship-arrow::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 9px;
  width: 8px;
  height: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
}

.ship-arrow-wrap::before {
  content: none;
  position: absolute;
  left: 5px;
  top: 0;
  width: 36px;
  height: 44px;
  background: #fff;
  clip-path: polygon(50% 0, 88% 100%, 50% 84%, 12% 100%);
  transform: rotate(var(--course));
  transform-origin: 50% 58%;
}

.ship-arrow-wrap .fleet-vessel-code {
  position: absolute;
  left: 50%;
  bottom: -4px;
  min-width: 29px;
  padding: 2px 5px;
  border: 1px solid color-mix(in srgb, var(--ship-color) 72%, #ffffff);
  border-radius: 4px;
  background: #071923;
  color: #f8fafc;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 2px 5px rgba(2, 6, 23, 0.48);
}

.fleet-icon-compact .ship-arrow-wrap {
  transform: scale(var(--map-vessel-scale, 0.72));
}

.fleet-icon-compact .ship-arrow-wrap .fleet-vessel-code {
  display: none;
}

.fleet-true-scale-on .ship-arrow-wrap {
  filter: none;
}

.fleet-true-scale-on .ship-arrow-wrap .fleet-vessel-sprite {
  opacity: 0;
}

.fleet-true-scale-on .ship-arrow-wrap .fleet-vessel-code {
  left: calc(50% + 27px);
  top: 17px;
  bottom: auto;
  border: 1px solid color-mix(in srgb, var(--ship-color) 70%, #ffffff);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 12px rgba(8, 26, 35, 0.28);
}

.fleet-true-scale-footprint {
  filter: drop-shadow(0 0 4px rgba(2, 6, 23, 0.82));
}

.leaflet-overlay-pane path.vessel-track-flow-path {
  pointer-events: none;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.72));
  animation: vesselTrackFlow 1.65s linear infinite;
}

.vessel-track-arrow-icon {
  border: 0;
  background: transparent;
  pointer-events: none;
  overflow: visible !important;
}

.vessel-track-arrow {
  position: relative;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 50%;
  background: rgba(3, 15, 27, 0.92);
  box-shadow: inset 0 0 0 3px var(--track-arrow-color), 0 0 11px color-mix(in srgb, var(--track-arrow-color) 82%, #ffffff);
  transform: rotate(var(--track-arrow-angle));
  transform-origin: 50% 50%;
}

.vessel-track-arrow::after {
  position: absolute;
  left: -11px;
  width: 13px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--track-arrow-color));
  content: '';
  opacity: 0.86;
}

.vessel-track-arrow i {
  display: block;
  width: 19px;
  height: 14px;
  border: 0;
  background: var(--track-arrow-color);
  clip-path: polygon(0 7%, 100% 50%, 0 93%, 31% 50%);
  filter: drop-shadow(0 0 1px #ffffff) drop-shadow(0 0 4px var(--track-arrow-color));
  animation: vesselTrackArrowThrust 1.65s ease-in-out infinite;
  animation-delay: var(--track-arrow-delay);
}

.vessel-track-arrow.is-latest {
  width: 32px;
  height: 32px;
  margin: 0;
  border-width: 2px;
  box-shadow: inset 0 0 0 3px var(--track-arrow-color), 0 0 11px color-mix(in srgb, var(--track-arrow-color) 82%, #ffffff);
}

.vessel-track-arrow.is-latest i {
  width: 19px;
  height: 14px;
}

body.track-arrow-world .vessel-track-arrow.is-secondary {
  display: none;
}

@keyframes vesselTrackFlow {
  to { stroke-dashoffset: -32; }
}

@keyframes vesselTrackArrowThrust {
  0%, 100% { opacity: 0.82; transform: translateX(-1px) scale(0.94); }
  52% { opacity: 1; transform: translateX(4px) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .leaflet-overlay-pane path.vessel-track-flow-path {
    animation: none;
    stroke-dasharray: 2 12;
  }

  .vessel-track-arrow i {
    animation: none;
    opacity: 0.9;
  }
}

.leaflet-tooltip.fleet-footprint-tooltip {
  border: 1px solid rgba(14, 165, 233, 0.48);
  border-radius: 4px;
  background: rgba(2, 15, 25, 0.92);
  color: #f8fafc;
  font: 800 11px/1.25 Inter, system-ui, sans-serif;
  box-shadow: 0 8px 22px rgba(2, 6, 23, 0.3);
}

.ship-arrow-wrap.no_fix .ship-arrow,
.ship-arrow-wrap.offline .ship-arrow,
.ship-arrow-wrap.waiting .ship-arrow {
  filter: saturate(0.35);
  opacity: 0.85;
}

.ship-arrow-wrap.no_fix .fleet-vessel-sprite,
.ship-arrow-wrap.offline .fleet-vessel-sprite,
.ship-arrow-wrap.waiting .fleet-vessel-sprite {
  filter: saturate(0.35) drop-shadow(0 1px 2px rgba(2, 6, 23, 0.95));
  opacity: 0.85;
}

.meteo-indicator {
  position: relative;
  width: 74px;
  height: 74px;
  pointer-events: none;
}

.track-wx-indicator {
  position: relative;
  width: 96px;
  height: 96px;
  pointer-events: none;
  border: 1px solid rgba(238, 251, 255, 0.72);
  border-radius: 999px;
  background: rgba(5, 19, 28, 0.18);
  box-shadow: 0 0 0 2px rgba(5, 19, 28, 0.18), 0 10px 24px rgba(0, 0, 0, 0.22);
}

.track-wx-indicator::after {
  content: "";
  position: absolute;
  left: 43px;
  top: 43px;
  width: 10px;
  height: 10px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #0f172a;
}

.track-wx-indicator .wx-arrow.wind {
  left: 33px;
  top: 7px;
}

.track-wx-indicator .wx-arrow.current {
  right: 4px;
  top: 38px;
}

.track-wx-indicator .wx-arrow.wave {
  left: 33px;
  bottom: 7px;
}

.wx-arrow {
  position: absolute;
  width: 30px;
  height: 20px;
  filter: drop-shadow(0 2px 2px rgba(255, 255, 255, 0.95)) drop-shadow(0 5px 8px rgba(8, 26, 35, 0.22));
}

.wx-arrow.wind {
  left: 22px;
  top: 2px;
}

.wx-arrow.current {
  right: -2px;
  top: 27px;
}

.wx-arrow.wave {
  left: 22px;
  bottom: 2px;
}

.wx-arrow span {
  position: absolute;
  left: 4px;
  top: 9px;
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: var(--wx-color);
  transform: rotate(var(--wx-rot));
  transform-origin: 50% 50%;
}

.wx-arrow span::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -3px;
  width: 7px;
  height: 7px;
  border-top: 2px solid var(--wx-color);
  border-right: 2px solid var(--wx-color);
  transform: rotate(45deg);
}

.wx-arrow b {
  display: none;
}

.track-dot {
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--track-color);
  box-shadow: 0 4px 12px rgba(8, 26, 35, 0.28);
}

.track-dot.stationary {
  width: 18px;
  height: 18px;
  background: #fff;
  border-color: var(--track-color);
}

.track-dot span {
  color: var(--track-color);
  font-size: 9px;
  font-weight: 950;
  line-height: 1;
}

.track-tooltip {
  width: min(224px, calc(100vw - 34px));
  padding: 0;
  border: 1px solid rgba(34, 211, 238, 0.36);
  border-radius: 14px;
  background: rgba(4, 18, 28, 0.94);
  color: #eafaff;
  box-shadow: 0 18px 46px rgba(2, 12, 20, 0.34);
  backdrop-filter: blur(14px) saturate(125%);
}

.track-tooltip::before {
  border-top-color: rgba(4, 18, 28, 0.94);
}

.track-weather-popup .leaflet-popup-content-wrapper {
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.42);
  border-radius: 18px;
  color: #e6f7fb;
  background: rgba(4, 18, 28, 0.96);
  box-shadow: 0 24px 64px rgba(1, 10, 18, 0.46);
  backdrop-filter: blur(16px) saturate(130%);
}

.track-weather-popup .leaflet-popup-tip {
  background: rgba(5, 19, 28, 0.92);
}

.track-weather-popup .popup-data {
  color: rgba(230, 247, 251, 0.72);
}

.leaflet-popup.track-point-popup .leaflet-popup-content {
  width: min(356px, calc(100vw - 42px)) !important;
  min-width: 0;
  margin: 0;
}

.leaflet-popup.track-point-popup:has(.track-point-summary) .leaflet-popup-content {
  width: min(232px, calc(100vw - 42px)) !important;
}

.map-panel .leaflet-popup-pane { z-index: 760; }

.track-point-popup .leaflet-popup-close-button {
  top: 9px;
  right: 10px;
  z-index: 5;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: rgba(234, 250, 255, 0.72) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  font-size: 22px !important;
  line-height: 26px !important;
}

.track-point-card {
  position: relative;
  overflow: hidden;
  color: #eafaff;
  font-family: inherit;
}

.track-point-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--track-accent, #22d3ee);
}

.track-point-summary { padding: 13px 14px 12px 17px; }
.track-point-popup .track-point-summary { padding: 8px 9px 8px 13px; }
.track-summary-tooltip .track-point-summary { padding: 8px 9px 8px 13px; }

.track-point-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-right: 30px;
}

.track-point-head > div { min-width: 0; }
.track-point-head strong {
  display: block;
  color: #fff;
  font-size: 17px;
  font-weight: 950;
  letter-spacing: -0.02em;
}

.track-point-popup .track-point-summary .track-point-head strong { font-size: 15px; }

.track-point-micro-head {
  align-items: center;
  min-height: 25px;
  gap: 7px;
}

.track-point-popup .track-point-micro-head { padding-right: 30px; }
.track-summary-tooltip .track-point-micro-head { padding-right: 0; }
.track-point-micro-head .track-point-kicker { margin-bottom: 0; font-size: 7px; }
.track-point-micro-head strong { font-size: 14px !important; line-height: 1; }

.track-point-kicker {
  display: block;
  margin-bottom: 2px;
  color: #67e8f9;
  font-size: 9px;
  font-weight: 950;
  letter-spacing: 0.14em;
}

.track-state {
  max-width: 136px;
  overflow: hidden;
  padding: 5px 8px;
  border: 1px solid rgba(250, 204, 21, 0.38);
  border-radius: 999px;
  color: #fde68a;
  background: rgba(161, 98, 7, 0.2);
  font-size: 9px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-state.good { border-color:rgba(74,222,128,.42); color:#86efac; background:rgba(22,101,52,.25); }
.track-state.bad { border-color:rgba(248,113,113,.48); color:#fca5a5; background:rgba(127,29,29,.28); }

.track-point-time {
  display: block;
  margin-top: 5px;
  color: rgba(207, 238, 247, 0.68);
  font-size: 10px;
  font-weight: 750;
}

.track-point-popup .track-point-summary .track-point-time { margin-top: 2px; font-size: 9px; }

.track-summary-grid {
  display: grid;
  grid-template-columns: .82fr .82fr 1.36fr;
  gap: 6px;
  margin-top: 11px;
}

.track-point-popup .track-summary-grid { gap: 4px; margin-top: 5px; }
.track-summary-tooltip .track-summary-grid { gap: 4px; margin-top: 5px; }

.track-summary-grid > div {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(148, 210, 225, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
}

.track-point-popup .track-summary-grid > div { padding: 4px 5px; border-radius: 7px; }
.track-summary-tooltip .track-summary-grid > div { padding: 4px 5px; border-radius: 7px; }

.track-summary-grid span {
  display: block;
  overflow: hidden;
  color: rgba(190, 226, 235, 0.58);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.track-summary-grid strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: #f8fdff;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-point-popup .track-summary-grid strong { margin-top: 1px; font-size: 10px; }
.track-point-popup .track-summary-grid span { font-size: 6px; }
.track-summary-tooltip .track-summary-grid strong { margin-top: 1px; font-size: 10px; }
.track-summary-tooltip .track-summary-grid span { font-size: 6px; }

.track-weather-metric.good { border-color:rgba(74,222,128,.34); background:rgba(22,101,52,.22); }
.track-weather-metric.bad { border-color:rgba(248,113,113,.4); background:rgba(127,29,29,.24); }
.track-weather-metric.watch { border-color:rgba(250,204,21,.3); background:rgba(133,77,14,.18); }

.track-point-position {
  margin: 9px 0 0;
  overflow: hidden;
  color: rgba(190, 226, 235, 0.62);
  font-size: 9px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-point-summary-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}

.track-point-summary-foot .track-point-position {
  flex: 1 1 auto;
  margin: 0;
}

.track-detail-toggle,
.track-summary-toggle {
  border: 1px solid rgba(34, 211, 238, .48);
  border-radius: 10px;
  color: #071a25;
  background: #67e8f9;
  font: inherit;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .06em;
  cursor: pointer;
}

.track-detail-toggle {
  flex: 0 0 auto;
  min-width: 50px;
  margin: 0;
  padding: 5px 7px;
  border-radius: 7px;
  font-size: 8px;
}

.track-summary-toggle {
  flex: 0 0 auto;
  margin-right: 30px;
  padding: 7px 9px;
  color: #bff5ff;
  background: rgba(34, 211, 238, .1);
}

.track-detail-toggle:hover,
.track-detail-toggle:focus-visible { background:#a5f3fc; }
.track-summary-toggle:hover,
.track-summary-toggle:focus-visible { background:rgba(34,211,238,.22); }

.track-point-detail { padding-left:4px; }
.track-point-head-sticky {
  padding: 14px 14px 11px 15px;
  border-bottom: 1px solid rgba(148, 210, 225, .12);
  background: rgba(7, 28, 40, .96);
}

.track-point-detail-scroll {
  max-height: min(500px, calc(100vh - 178px));
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(103,232,249,.48) rgba(255,255,255,.04);
}

.track-detail-grid {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
  padding: 13px 14px 12px 15px;
  font-size: 11px;
}

.track-detail-grid dt { color:rgba(190,226,235,.58); font-weight:850; text-transform:uppercase; }
.track-detail-grid dd { min-width:0; margin:0; color:#f8fdff; font-weight:800; overflow-wrap:anywhere; }
.track-point-error { margin:0 14px 10px 15px; color:#fca5a5; font-size:10px; font-weight:800; }

@media (max-width: 760px) {
  .leaflet-popup.track-point-popup .leaflet-popup-content { width:min(316px, calc(100vw - 34px)) !important; }
  .leaflet-popup.track-point-popup:has(.track-point-summary) .leaflet-popup-content { width:min(224px, calc(100vw - 34px)) !important; }
  .track-summary-grid { grid-template-columns: .82fr .82fr 1.36fr; }
  .track-point-head strong { font-size:15px; }
  .track-point-detail-scroll { max-height:min(350px, calc(100vh - 482px)); }
  body.track-point-popup-open #aisLegend,
  body.track-point-popup-open .speed-color-panel {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
  }
}

/* Live Track geofence and compact control refinements. */
body:not(.controls-expanded) #aisSettingsBtn,
body:not(.controls-expanded) #aisReceiverBtn,
body:not(.controls-expanded) #depthsLayerBtn,
body:not(.controls-expanded) #cycloneLayerBtn,
body:not(.controls-expanded) #oceanRiskBtn,
body:not(.controls-expanded) #rangeRingBtn,
body:not(.controls-expanded) #zonesBtn,
body:not(.controls-expanded) #fullscreenBtn,
body:not(.controls-expanded) #tvModeBtn,
body:not(.controls-expanded) #refreshBtn,
body:not(.controls-expanded) .top-actions > .link-btn {
  display: none;
}

#controlMoreBtn.active {
  color: #fff;
  background: #0d6e86;
  box-shadow: inset 0 0 0 1px #23c5df;
}

.geofence-btn {
  color: #063d36;
  background: #b8f3e5;
  box-shadow: inset 0 0 0 1px #19a98b;
}

.geofence-btn.active {
  color: #fff;
  background: #087f6a;
}

.geofence-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 880;
  display: flex;
  width: min(700px, calc(100vw - 20px));
  min-width: min(420px, calc(100vw - 20px));
  max-width: calc(100vw - 20px);
  height: min(720px, calc(100dvh - 20px));
  min-height: 260px;
  max-height: calc(100dvh - 20px);
  flex-direction: column;
  overflow: hidden;
  resize: both;
  color: #e9fbff;
  border: 1px solid rgba(45, 212, 191, .55);
  border-radius: 8px;
  background: rgba(3, 22, 31, .97);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .5);
  backdrop-filter: blur(16px);
}

.geofence-panel.hidden { display: none; }
.geofence-panel.is-dragging { opacity: .96; box-shadow: 0 28px 76px rgba(0, 0, 0, .62); }
.geofence-panel.is-compact {
  width: 320px !important;
  min-width: 0;
  height: 54px !important;
  min-height: 54px;
  resize: none;
}
.geofence-panel.is-compact > :not(.geofence-head) { display: none !important; }

.geofence-head,
.geofence-toolbar,
.geofence-section-title,
.geofence-actions,
.geofence-geometry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.geofence-head {
  flex: 0 0 auto;
  min-height: 54px;
  padding: 9px 10px 9px 14px;
  border-bottom: 1px solid rgba(45, 212, 191, .24);
  background: #0a3d49;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.geofence-head:active { cursor: grabbing; }
.geofence-head-title { display: grid; gap: 2px; }
.geofence-head span { color: #6ee7d4; font: 900 9px/1 ui-monospace, monospace; letter-spacing: .1em; }
.geofence-head strong { color: #fff; font-size: 19px; }
.geofence-head-actions { display: flex; align-items: center; gap: 6px; }
.geofence-head button {
  width: 34px;
  height: 34px;
  padding: 0;
  color: #d9f9f4;
  border: 1px solid rgba(110, 231, 212, .35);
  border-radius: 6px;
  background: rgba(1, 14, 22, .58);
  font-size: 24px;
  cursor: pointer;
}
.geofence-head-actions button:first-child { font-size: 18px; }
.geofence-head-actions button:nth-child(2) { font-size: 22px; }

.geofence-toolbar { flex: 0 0 auto; padding: 10px 12px 6px; }
.geofence-toolbar button,
.geofence-actions button,
.geofence-geometry button {
  min-height: 34px;
  padding: 0 12px;
  color: #dff7fb;
  border: 1px solid rgba(125, 211, 252, .3);
  border-radius: 6px;
  background: #102f3e;
  font-weight: 800;
  cursor: pointer;
}

.geofence-primary { color: #03211e !important; background: #5eead4 !important; border-color: #2dd4bf !important; }
.geofence-danger { color: #ffd9df !important; border-color: #fb7185 !important; background: #581827 !important; }
.geofence-status { flex: 0 0 auto; margin: 0; padding: 3px 12px 9px; color: #96b7c0; font-size: 11px; }
.geofence-status.error { color: #fda4af; }
.geofence-status.ok { color: #5eead4; }

.geofence-guide {
  margin: 0 12px 9px;
  border: 1px solid rgba(94, 234, 212, .2);
  border-radius: 6px;
  background: rgba(10, 61, 73, .42);
}
.geofence-guide summary {
  padding: 8px 10px;
  color: #dff9fd;
  font-size: 10px;
  font-weight: 850;
  cursor: pointer;
}
.geofence-guide > div {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 0 9px 9px;
}
.geofence-guide > div > span { display: flex; align-items: center; gap: 5px; color: #b8d9df; font-size: 9px; font-weight: 800; }
.geofence-guide > div > span b {
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  place-items: center;
  color: #042725;
  border-radius: 50%;
  background: #5eead4;
}
.geofence-guide > div > small { grid-column: 1 / -1; color: #7fa5ae; font-size: 9px; line-height: 1.35; }

.geofence-form {
  flex: 1 1 auto;
  display: grid;
  gap: 10px;
  max-height: calc(100dvh - 142px);
  padding: 11px 12px;
  overflow-y: auto;
  border-top: 1px solid rgba(45, 212, 191, .18);
  border-bottom: 1px solid rgba(45, 212, 191, .18);
  background: rgba(7, 39, 49, .78);
}

.geofence-form.hidden { display: none; }
.geofence-panel.editing .geofence-guide,
.geofence-panel.editing .geofence-summary,
.geofence-panel.editing .geofence-tabs,
.geofence-panel.editing .geofence-pane { display: none; }
.geofence-step {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(125, 211, 252, .18);
  border-radius: 7px;
  background: rgba(2, 18, 28, .52);
}
.geofence-step > header { display: flex; align-items: center; gap: 8px; }
.geofence-step > header > b {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  place-items: center;
  color: #03211e;
  border-radius: 50%;
  background: #5eead4;
  font-size: 12px;
}
.geofence-step > header > span { display: grid; gap: 2px; min-width: 0; }
.geofence-step > header strong { color: #fff; font-size: 12px; }
.geofence-step > header small { color: #83a9b2; font-size: 9px; line-height: 1.25; }
.geofence-form-row { display: grid; grid-template-columns: minmax(0, 1fr) 74px; gap: 8px; }
.geofence-step > label,
.geofence-form-row label { display: grid; gap: 4px; min-width: 0; color: #91b4be; font-size: 10px; font-weight: 800; }
.geofence-form input[type="text"],
.geofence-form input[type="number"],
.geofence-form input[type="time"],
.geofence-form select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  color: #f5fdff;
  border: 1px solid #28566a;
  border-radius: 6px;
  outline: none;
  background: #061b29;
  box-sizing: border-box;
}
.geofence-form input[type="text"]:focus,
.geofence-form input[type="number"]:focus,
.geofence-form input[type="time"]:focus,
.geofence-form select:focus { border-color: #2dd4bf; box-shadow: 0 0 0 2px rgba(45, 212, 191, .16); }
.geofence-color-field input { width: 100%; height: 36px; padding: 3px; border: 1px solid #28566a; border-radius: 6px; background: #061b29; }

.geofence-event-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(125, 211, 252, .2);
  border-radius: 6px;
}
.geofence-event-options legend { padding: 0 5px; color: #79d9e8; font-size: 10px; font-weight: 900; }
.geofence-event-options label {
  display: flex;
  min-width: 0;
  gap: 6px;
  padding: 7px;
  border: 1px solid rgba(125, 211, 252, .12);
  border-radius: 5px;
  background: #071d29;
}
.geofence-event-options label:has(input:checked) { border-color: #2dd4bf; background: #0b3741; }
.geofence-event-options input { margin-top: 2px; accent-color: #2dd4bf; }
.geofence-event-options span { display: grid; gap: 3px; min-width: 0; }
.geofence-event-options strong { color: #eefcff; font-size: 10px; }
.geofence-event-options small { color: #82a7af; font-size: 8px; line-height: 1.3; }

.geofence-status-transition {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(167, 139, 250, .5);
  border-radius: 7px;
  background: linear-gradient(145deg, rgba(76, 29, 149, .23), rgba(6, 27, 41, .96));
  box-shadow: inset 0 0 22px rgba(139, 92, 246, .08);
}
.geofence-status-transition.hidden { display: none; }
.geofence-transition-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.geofence-transition-head > span { display: grid; gap: 2px; }
.geofence-transition-head strong { color: #f5f3ff; font-size: 11px; }
.geofence-transition-head small { color: #b9acd8; font-size: 8px; line-height: 1.35; }
.geofence-transition-head em { flex: 0 0 auto; padding: 4px 6px; color: #ddd6fe; border: 1px solid rgba(167, 139, 250, .45); border-radius: 4px; background: rgba(76, 29, 149, .34); font: 900 8px/1 ui-monospace, monospace; font-style: normal; }
.geofence-transition-rule-list { display: grid; gap: 7px; }
.geofence-transition-rule { display: grid; grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 32px; align-items: end; gap: 6px; padding: 7px; border: 1px solid rgba(167, 139, 250, .2); border-radius: 6px; background: rgba(2, 18, 28, .5); }
.geofence-transition-rule label { display: grid; gap: 4px; min-width: 0; color: #c4b5fd; font-size: 9px; font-weight: 850; }
.geofence-transition-rule > i { display: grid; height: 36px; place-items: center; color: #c4b5fd; font-size: 18px; font-style: normal; }
.geofence-transition-rule > button { display: grid; width: 32px; height: 36px; place-items: center; padding: 0; color: #fecdd3; border: 1px solid rgba(251, 113, 133, .36); border-radius: 6px; background: rgba(127, 29, 29, .28); cursor: pointer; font-size: 19px; }
.geofence-transition-rule > button:hover:not(:disabled) { color: #fff; border-color: #fb7185; background: rgba(190, 24, 93, .5); }
.geofence-transition-rule > button:disabled { opacity: .3; cursor: not-allowed; }
.geofence-transition-actions { display: flex; align-items: center; gap: 9px; }
.geofence-transition-actions > button { flex: 0 0 auto; min-height: 32px; padding: 0 11px; color: #ede9fe; border: 1px solid rgba(167, 139, 250, .5); border-radius: 6px; background: rgba(109, 40, 217, .34); cursor: pointer; font-size: 9px; font-weight: 900; }
.geofence-transition-actions > button:hover:not(:disabled) { border-color: #c4b5fd; background: rgba(124, 58, 237, .56); }
.geofence-transition-actions > button:disabled { opacity: .45; cursor: not-allowed; }
.geofence-transition-actions > small { color: #9889b7; font-size: 8px; line-height: 1.3; }
.geofence-status-transition p { margin: 0; padding: 7px 8px; color: #a9c5ce; border-left: 3px solid #8b5cf6; background: rgba(2, 18, 28, .48); font-size: 8.5px; line-height: 1.45; }
.geofence-status-transition p b { color: #ede9fe; }

.geofence-source-options,
.geofence-types {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.geofence-types {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(125, 211, 252, .2);
  border-radius: 6px;
}

.geofence-types legend { padding: 0 5px; color: #79d9e8; font-size: 10px; font-weight: 900; }
.geofence-source-options label,
.geofence-types label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 7px;
  color: #dceff4;
  border-radius: 5px;
  background: rgba(2, 18, 28, .62);
  font-size: 10px;
  font-weight: 750;
}
.geofence-source-options input,
.geofence-types input { accent-color: #2dd4bf; }
.geofence-filter-row { display: grid; grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); gap: 8px; }
.geofence-filter-row > label { display: grid; gap: 4px; color: #91b4be; font-size: 10px; font-weight: 800; }
.geofence-unit-input { position: relative; }
.geofence-unit-input input { padding-right: 34px !important; }
.geofence-unit-input em { position: absolute; top: 11px; right: 10px; color: #6ee7d4; font: 900 10px/1 ui-monospace, monospace; font-style: normal; }
.geofence-filter-note { color: #7fa5ae; font-size: 9px; line-height: 1.35; }
.geofence-active-option {
  display: flex !important;
  align-items: flex-start;
  gap: 8px !important;
  padding: 8px;
  border-radius: 6px;
  background: rgba(13, 90, 83, .22);
}
.geofence-active-option input { margin-top: 3px; accent-color: #2dd4bf; }
.geofence-active-option > span { display: grid; gap: 2px; }
.geofence-active-option strong { color: #dcfff9; font-size: 10px; }
.geofence-active-option small { color: #7fa5ae; font-size: 8px; }
.geofence-email-note { margin: 0; padding: 8px; color: #a9c9cf; border-left: 3px solid #38bdf8; background: rgba(14, 71, 94, .24); font-size: 9px; line-height: 1.45; }
.geofence-daily-report { display: grid; gap: 8px; padding: 10px; border: 1px solid rgba(21, 200, 194, .35); border-radius: 7px; background: linear-gradient(145deg, rgba(7, 54, 71, .78), rgba(5, 34, 45, .9)); }
.geofence-daily-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.geofence-daily-head > span { display: grid; gap: 2px; }
.geofence-daily-head strong { color: #eafffd; font-size: 11px; }
.geofence-daily-head small { color: #82a7af; font-size: 8px; line-height: 1.35; }
.geofence-daily-head em { flex: 0 0 auto; padding: 4px 6px; color: #99f6e4; border: 1px solid rgba(45, 212, 191, .45); border-radius: 4px; background: rgba(13, 148, 136, .25); font: 900 8px/1 ui-monospace, monospace; font-style: normal; }
.geofence-daily-fields { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: 7px; }
.geofence-daily-report > label,
.geofence-daily-fields > label { display: grid; gap: 4px; color: #91b4be; font-size: 9px; font-weight: 800; }
.geofence-daily-report input[readonly] { color: #88a9b2; background: #082531; }
.geofence-report-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.geofence-report-actions button { min-height: 31px; padding: 0 6px; color: #dffffb; border: 1px solid rgba(45, 212, 191, .38); border-radius: 6px; background: rgba(13, 148, 136, .2); cursor: pointer; font-size: 8.5px; font-weight: 900; }
.geofence-report-actions button:hover:not(:disabled) { border-color: #5eead4; background: rgba(13, 148, 136, .42); }
.geofence-report-actions button:disabled { opacity: .4; cursor: default; }
.geofence-daily-report > p { margin: 0; padding: 7px 8px; color: #a9c5ce; border-left: 3px solid #15c8c2; background: rgba(2, 18, 28, .45); font-size: 8.5px; line-height: 1.45; }
.geofence-geometry { min-height: 48px; padding: 6px 8px; border: 1px dashed #2d7182; border-radius: 6px; }
.geofence-geometry > span { display: grid; flex: 1 1 auto; gap: 3px; min-width: 0; }
.geofence-geometry > span strong { color: #dff9fd; font: 900 10px/1.25 ui-monospace, monospace; }
.geofence-geometry > span small { color: #789da7; font: 700 8px/1.25 ui-monospace, monospace; }
.geofence-vertex-icon {
  display: grid !important;
  place-items: center;
  border: 0 !important;
  background: transparent !important;
  cursor: grab !important;
}
.geofence-vertex-icon span {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--vertex-color, #f97316);
  box-shadow: 0 0 0 2px #06202d, 0 4px 12px rgba(0, 0, 0, .55);
  cursor: grab;
}
.geofence-vertex-icon span:active { cursor: grabbing; }
.geofence-vertex-dragging,
.geofence-vertex-dragging .leaflet-container { cursor: grabbing !important; }
.geofence-actions { justify-content: flex-end; }

.geofence-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  flex: 0 0 auto;
  margin: 0 12px 9px;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, .18);
  border-radius: 6px;
  background: rgba(125, 211, 252, .12);
}
.geofence-summary > div { display: grid; gap: 3px; min-width: 0; padding: 8px 10px; background: #071d29; }
.geofence-summary span { overflow: hidden; color: #7fa5ae; font-size: 8px; font-weight: 850; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.geofence-summary strong { color: #67e8f9; font: 900 17px/1 ui-monospace, monospace; }
.geofence-summary .attention strong { color: #fbbf24; }

.geofence-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  flex: 0 0 auto;
  padding: 0 12px 8px;
}
.geofence-tabs button {
  min-height: 34px;
  color: #93b6bf;
  border: 1px solid rgba(125, 211, 252, .2);
  border-radius: 6px;
  background: #071d29;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}
.geofence-tabs button span { margin-left: 5px; color: #67e8f9; font: 900 10px/1 ui-monospace, monospace; }
.geofence-tabs button.active { color: #042725; border-color: #5eead4; background: #5eead4; }
.geofence-tabs button.active span { color: #07535a; }

.geofence-pane { min-height: 0; flex: 1 1 auto; }
.geofence-pane.hidden { display: none; }
.geofence-list-section,
.geofence-events-section,
.geofence-timeline-section { min-height: 0; padding: 2px 12px 11px; overflow: hidden; }
.geofence-section-title { display: grid; justify-content: start; gap: 2px; margin-bottom: 7px; color: #dff9fd; font-size: 12px; }
.geofence-section-title small { color: #7898a1; font-size: 8px; font-weight: 650; }
.geofence-zone-list { display: grid; gap: 6px; max-height: calc(100% - 38px); overflow-y: auto; padding-right: 3px; }
.geofence-zone-list > p { margin: 8px 0; color: #7898a1; font-size: 11px; }
.geofence-zone-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px;
  color: #e8fbff;
  border: 1px solid rgba(125, 211, 252, .18);
  border-radius: 6px;
  text-align: left;
  background: rgba(8, 41, 53, .7);
  cursor: pointer;
}
.geofence-zone-item:hover { border-color: #2dd4bf; background: #0b3a48; }
.geofence-zone-item > i { width: 8px; height: 28px; border-radius: 3px; background: var(--zone-color); }
.geofence-zone-item strong { display: block; color: #fff; font-size: 12px; }
.geofence-zone-item small { display: block; margin-top: 2px; color: #88a9b2; font-size: 9px; }
.geofence-zone-item small.status-rule { color: #c4b5fd; }
.geofence-zone-item small.daily-report { color: #5eead4; }
.geofence-zone-item em { color: #63e6d2; font: 900 9px/1 ui-monospace, monospace; font-style: normal; }
.geofence-zone-item.disabled em { color: #94a3b8; }

.geofence-event-tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(105px, 1fr));
  gap: 6px;
  padding: 0 0 8px;
}
.geofence-event-tools .geofence-search { grid-column: span 2; }
.geofence-event-tools label { display: grid; gap: 3px; min-width: 0; }
.geofence-event-tools label > span { color: #7898a1; font-size: 8px; font-weight: 850; text-transform: uppercase; }
.geofence-event-tools input,
.geofence-event-tools select {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  color: #e8fbff;
  border: 1px solid #28566a;
  border-radius: 5px;
  outline: none;
  background: #061b29;
  font-size: 10px;
}
.geofence-event-tools input:focus,
.geofence-event-tools select:focus { border-color: #2dd4bf; box-shadow: 0 0 0 2px rgba(45, 212, 191, .14); }
.geofence-register-actions { display: grid; grid-template-columns: minmax(150px, 1fr) auto auto; align-items: center; gap: 8px; padding: 0 0 8px; }
.geofence-register-actions p { margin: 0; color: #dff9fd; font-size: 10px; }
.geofence-register-actions p span { margin-left: 6px; color: #7898a1; }
.geofence-register-actions > div { display: flex; gap: 5px; }
.geofence-page-controls { align-items: center; }
.geofence-page-controls span { min-width: 48px; color: #91b4be; font: 850 9px/1 ui-monospace, monospace; text-align: center; }
.geofence-register-actions button:disabled { opacity: .42; cursor: default; }
.geofence-register-actions button,
.geofence-map-focus {
  min-height: 29px;
  padding: 0 9px;
  color: #dff7fb;
  border: 1px solid rgba(125, 211, 252, .28);
  border-radius: 5px;
  background: #102f3e;
  font-size: 9px;
  font-weight: 850;
  cursor: pointer;
}
.geofence-register-wrap { max-height: calc(100% - 136px); overflow: auto; border: 1px solid rgba(125, 211, 252, .18); border-radius: 6px; }
.geofence-register-table { width: 100%; min-width: 670px; border-collapse: collapse; table-layout: fixed; }
.geofence-register-table th,
.geofence-register-table td { padding: 8px 7px; border-bottom: 1px solid rgba(125, 211, 252, .12); text-align: left; vertical-align: middle; }
.geofence-register-table th { position: sticky; top: 0; z-index: 1; color: #7fa5ae; background: #082531; font-size: 8px; font-weight: 900; text-transform: uppercase; }
.geofence-register-table td { color: #dceff4; background: rgba(7, 29, 41, .78); font-size: 9px; }
.geofence-register-table tr:hover td { background: #0b3441; }
.geofence-register-table th:nth-child(1) { width: 16%; }
.geofence-register-table th:nth-child(2) { width: 20%; }
.geofence-register-table th:nth-child(3) { width: 22%; }
.geofence-register-table th:nth-child(4) { width: 17%; }
.geofence-register-table th:nth-child(5) { width: 14%; }
.geofence-register-table th:nth-child(6) { width: 11%; }
.geofence-register-table td strong { display: block; overflow: hidden; color: #fff; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.geofence-register-table td small { display: block; margin-top: 2px; overflow: hidden; color: #7898a1; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.geofence-event-badge,
.geofence-mail-badge { display: inline-block; padding: 3px 5px; border-radius: 4px; font: 900 8px/1 ui-monospace, monospace; }
.geofence-event-badge { color: #dff9fd; border: 1px solid var(--zone-color, #38bdf8); background: color-mix(in srgb, var(--zone-color, #38bdf8) 18%, #061b29); }
.geofence-mail-badge.sent { color: #5eead4; background: rgba(13, 148, 136, .2); }
.geofence-mail-badge.skipped { color: #fbbf24; background: rgba(217, 119, 6, .2); }
.geofence-mail-badge.attention { color: #fda4af; background: rgba(225, 29, 72, .2); }
.geofence-empty-row td { padding: 26px 10px; color: #7898a1; text-align: center; }

.geofence-timeline-section { display: flex; flex-direction: column; }
.geofence-timeline-section.hidden { display: none; }
.geofence-timeline-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: 0 0 auto; padding-bottom: 8px; }
.geofence-timeline-head > div { display: grid; gap: 2px; min-width: 0; }
.geofence-timeline-head strong { color: #f2fdff; font-size: 12px; }
.geofence-timeline-head small { overflow: hidden; color: #7898a1; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.geofence-timeline-head button {
  min-height: 30px; padding: 0 10px; flex: 0 0 auto; color: #dff9fd; border: 1px solid rgba(94, 234, 212, .35);
  border-radius: 5px; background: #103642; font-size: 9px; font-weight: 900; cursor: pointer;
}
.geofence-timeline-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; flex: 0 0 auto; padding-bottom: 8px; }
.geofence-timeline-tools label { display: grid; gap: 3px; min-width: 0; }
.geofence-timeline-tools label > span { color: #7898a1; font-size: 8px; font-weight: 850; text-transform: uppercase; }
.geofence-timeline-tools select {
  width: 100%; min-width: 0; height: 32px; padding: 0 8px; color: #e8fbff; border: 1px solid #28566a;
  border-radius: 5px; outline: none; background: #061b29; font-size: 10px;
}
.geofence-timeline-tools select:focus { border-color: #2dd4bf; box-shadow: 0 0 0 2px rgba(45, 212, 191, .14); }
.geofence-timeline-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; flex: 0 0 auto; overflow: hidden; margin-bottom: 7px; border: 1px solid rgba(125, 211, 252, .18); border-radius: 6px; background: rgba(125, 211, 252, .15); }
.geofence-timeline-kpis > div { display: grid; gap: 3px; min-width: 0; padding: 7px 8px; background: #071d29; }
.geofence-timeline-kpis span { overflow: hidden; color: #7898a1; font-size: 7px; font-weight: 850; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.geofence-timeline-kpis strong { overflow: hidden; color: #67e8f9; font: 900 13px/1 ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; }
.geofence-timeline-legend { display: flex; gap: 12px; align-items: center; flex: 0 0 auto; padding: 0 2px 7px; color: #8eabb3; font-size: 8px; }
.geofence-timeline-legend span { display: inline-flex; gap: 5px; align-items: center; }
.geofence-timeline-legend i { width: 13px; height: 5px; border-radius: 2px; background: #2dd4bf; }
.geofence-timeline-legend i.crossing { background: #f59e0b; }
.geofence-timeline-legend i.status-change { background: #8b5cf6; }
.geofence-timeline-legend i.open { border: 1px dashed #67e8f9; background: transparent; }
.geofence-timeline-empty { padding: 28px 10px; color: #7898a1; text-align: center; font-size: 10px; }
.geofence-timeline-empty.hidden { display: none; }
.geofence-timeline-viewport { min-height: 180px; flex: 1 1 auto; overflow: auto; border: 1px solid rgba(125, 211, 252, .18); border-radius: 6px; background: #061923; }
.geofence-timeline-axis,
.geofence-timeline-row { display: grid; grid-template-columns: 150px minmax(520px, 1fr); min-width: 670px; }
.geofence-timeline-axis { position: sticky; top: 0; z-index: 4; min-height: 32px; border-bottom: 1px solid rgba(125, 211, 252, .22); background: #082531; }
.geofence-timeline-axis-label { padding: 10px 9px; color: #6f929c; font: 900 8px/1 ui-monospace, monospace; text-transform: uppercase; }
.geofence-timeline-axis-track { position: relative; min-height: 32px; border-left: 1px solid rgba(125, 211, 252, .16); }
.geofence-timeline-axis-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(125, 211, 252, .17); }
.geofence-timeline-axis-tick span { position: absolute; top: 10px; left: 5px; color: #7898a1; font: 800 8px/1 ui-monospace, monospace; white-space: nowrap; }
.geofence-timeline-row { min-height: 50px; border-bottom: 1px solid rgba(125, 211, 252, .1); }
.geofence-timeline-row:last-child { border-bottom: 0; }
.geofence-timeline-row-label { display: grid; align-content: center; gap: 2px; min-width: 0; padding: 7px 9px; background: rgba(7, 29, 41, .88); }
.geofence-timeline-row-label strong,
.geofence-timeline-row-label small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.geofence-timeline-row-label strong { color: #f4fdff; font-size: 10px; }
.geofence-timeline-row-label small { color: #7898a1; font-size: 8px; }
.geofence-timeline-track { position: relative; min-height: 50px; overflow: hidden; border-left: 1px solid rgba(125, 211, 252, .16); background: #071d29; }
.geofence-timeline-band { position: absolute; top: 10px; min-width: 8px; height: 29px; padding: 0 7px; overflow: hidden; color: #042725; border: 1px solid rgba(255, 255, 255, .42); border-radius: 5px; background: var(--zone-color, #2dd4bf); box-shadow: 0 5px 12px rgba(0, 0, 0, .24); font-size: 8px; font-weight: 900; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.geofence-timeline-band:hover { z-index: 3; filter: brightness(1.18); transform: translateY(-1px); }
.geofence-timeline-band.crossing { top: 15px; width: 12px !important; height: 19px; padding: 0; border-radius: 50%; background: #f59e0b; }
.geofence-timeline-band.status-change { color: #fff; border-color: rgba(237, 233, 254, .72); background: linear-gradient(90deg, #6d28d9, #8b5cf6); }
.geofence-timeline-band.open { color: #e9fbff; border: 1px dashed #67e8f9; background: rgba(8, 86, 99, .82); }
.geofence-timeline-now { position: absolute; top: 0; bottom: 0; z-index: 2; width: 2px; background: #fb7185; box-shadow: 0 0 8px rgba(251, 113, 133, .65); pointer-events: none; }

body.geofence-drawing #map { cursor: crosshair; }
body.geofence-drawing .geofence-panel { opacity: .94; }

body.clean-map .speed-color-panel,
body.clean-map #aisLegend,
body.clean-map .fleet-ticker,
body.clean-map .map-cursor-control,
body.clean-map .ais-receiver-panel,
body.clean-map .ais-settings-panel,
body.clean-map .geofence-panel,
body.clean-map .ocean-risk-panel,
body.clean-map .measure-panel,
body.clean-map .range-ring-panel,
body.clean-map .zones-panel,
body.clean-map .map-vessel-panel,
body.clean-map .side-panel,
body.clean-map .leaflet-control-container,
body.clean-map #umayLauncher,
body.clean-map #umayBackdrop,
body.clean-map #umayPanel {
  display: none !important;
}

body.clean-map .shell { grid-template-columns: minmax(0, 1fr) !important; }
body.clean-map .show-controls-btn { display: inline-flex !important; z-index: 1200; }

@media (max-width: 760px) {
  .geofence-panel {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 92dvh;
    max-height: 88dvh;
    min-width: 0;
    min-height: 220px;
    resize: none;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 12px 12px 0 0;
  }
  .geofence-panel.is-compact {
    right: 8px;
    bottom: 8px;
    left: auto;
    width: min(320px, calc(100vw - 16px)) !important;
    height: 48px !important;
    min-height: 48px;
    border: 1px solid rgba(45, 212, 191, .55);
    border-radius: 8px;
  }
  .geofence-head { cursor: default; touch-action: auto; }
  .geofence-form { max-height: calc(88dvh - 126px); }
  .geofence-event-options { grid-template-columns: 1fr; }
  .geofence-transition-rule { position: relative; grid-template-columns: 1fr; padding-right: 46px; }
  .geofence-transition-rule > i { height: 18px; transform: rotate(90deg); }
  .geofence-transition-rule > button { position: absolute; top: 7px; right: 7px; }
  .geofence-transition-actions { align-items: flex-start; flex-direction: column; }
  .geofence-source-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .geofence-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .geofence-event-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .geofence-search { grid-column: 1 / -1; }
  .geofence-timeline-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .geofence-timeline-axis,
  .geofence-timeline-row { grid-template-columns: 118px minmax(500px, 1fr); min-width: 618px; }
  .geofence-register-actions { grid-template-columns: 1fr auto; align-items: start; }
  .geofence-register-actions p { grid-column: 1 / -1; }
  .geofence-register-actions > div { flex-wrap: wrap; justify-content: flex-end; }
  body.controls-expanded .topbar.compact-bar .top-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 460px) {
  .geofence-panel { max-height: 94dvh; border-radius: 9px 9px 0 0; }
  .geofence-head { min-height: 48px; }
  .geofence-toolbar { padding-top: 7px; }
  .geofence-guide { display: none; }
  .geofence-summary > div { padding: 7px 8px; }
  .geofence-summary strong { font-size: 15px; }
  .geofence-event-tools { grid-template-columns: 1fr 1fr; }
  .geofence-timeline-tools { grid-template-columns: 1fr; }
  .geofence-register-actions { grid-template-columns: 1fr; }
  .geofence-register-actions > div { justify-content: flex-start; }
  .geofence-register-wrap { max-height: calc(100% - 196px); border: 0; }
  .geofence-register-table { display: block; min-width: 0; }
  .geofence-register-table thead { display: none; }
  .geofence-register-table tbody { display: grid; gap: 7px; }
  .geofence-register-table tr { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border: 1px solid rgba(125, 211, 252, .2); border-left: 4px solid var(--zone-color, #38bdf8); border-radius: 6px; background: #071d29; }
  .geofence-register-table td { min-width: 0; padding: 7px 8px; border: 0; background: transparent; }
  .geofence-register-table td:nth-child(5) { align-self: center; }
  .geofence-register-table td:nth-child(6) { text-align: right; }
  .geofence-register-table tr:hover td { background: transparent; }
  .geofence-empty-row { display: block !important; }
  .geofence-empty-row td { display: block; }
}

.ship-info-box {
  width: 188px;
  padding: 9px 10px;
  border: 1px solid rgba(16, 32, 44, 0.15);
  border-left: 4px solid var(--ship-color);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(8, 26, 35, 0.16);
  backdrop-filter: blur(10px);
}

.ship-info-box strong {
  display: block;
  margin-bottom: 6px;
  overflow: hidden;
  color: var(--ship-color);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ship-info-box dl {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 3px 7px;
  margin: 0;
  font-size: 11px;
}

.ship-info-box dt {
  color: var(--muted);
  font-weight: 850;
  text-transform: uppercase;
}

.ship-info-box dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaflet-popup-content {
  margin: 11px 13px;
  min-width: 210px;
}

.leaflet-popup.nav-popup .leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
}

.leaflet-popup.nav-popup .leaflet-popup-content {
  width: 340px !important;
  min-width: 320px;
  margin: 0;
}

.leaflet-popup.nav-popup .leaflet-popup-tip-container {
  display: none;
}

.leaflet-popup.nav-popup a.leaflet-popup-close-button {
  top: 8px;
  right: 9px;
  z-index: 5;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #eaf8ff;
  background: rgba(0, 0, 0, 0.38);
  font-size: 20px;
  line-height: 22px;
  text-shadow: none;
}

.nav-popup-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-left: 4px solid var(--ship-color, #00d5ff);
  border-radius: 16px;
  background: rgba(5, 19, 28, 0.58);
  color: #effcff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(10px) saturate(1.15);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.64);
}

.nav-popup-card header {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 14px 8px;
}

.nav-popup-card header strong {
  display: block;
  color: var(--ship-color, #00d5ff);
  font-size: 17px;
  font-weight: 950;
}

.nav-popup-card header span {
  display: block;
  margin-top: 2px;
  color: rgba(231, 249, 255, 0.82);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.nav-popup-card header em {
  flex: 0 0 auto;
  margin-right: 18px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, 0.28);
  font-style: normal;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.nav-compass {
  position: relative;
  height: 214px;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.2), transparent 38%),
    rgba(255, 255, 255, 0.08);
}

.nav-compass svg {
  display: block;
  width: 100%;
  height: 214px;
}

.nav-compass .ring {
  fill: rgba(255, 255, 255, 0.08);
  stroke: rgba(238, 251, 255, 0.9);
  stroke-width: 2;
}

.nav-compass .ticks line {
  stroke: rgba(238, 251, 255, 0.8);
  stroke-width: 1.2;
}

.nav-compass .ticks line.major {
  stroke-width: 2;
}

.nav-compass .north-mark {
  fill: #f43f5e;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

.nav-compass .cardinal {
  fill: #f5fbff;
  font-size: 18px;
  font-weight: 950;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(5, 19, 28, 0.7);
  stroke-width: 3px;
}

.nav-compass .ship-shape .course-vector {
  stroke: var(--ship-color, #00d5ff);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 5 5;
  opacity: 0.72;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.42));
}

.nav-compass .ais-compass-vessel .ais-hull {
  fill: var(--ship-color, #00d5ff);
  stroke: #f8fafc;
  stroke-width: 0.9;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.48));
}

.nav-compass .ais-compass-vessel .ais-deck {
  fill: color-mix(in srgb, var(--ship-color, #00d5ff) 38%, #07111f);
  stroke: rgba(255, 255, 255, 0.72);
  stroke-width: 0.55;
}

.nav-compass .ais-compass-vessel .ais-centerline {
  fill: none;
  stroke: rgba(255, 255, 255, 0.68);
  stroke-width: 0.45;
}

.nav-compass .speed-plate {
  fill: rgba(255, 255, 255, 0.9);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.25));
}

.nav-compass .speed-text {
  fill: #0b1620;
  font-size: 17px;
  font-weight: 950;
  text-anchor: middle;
  text-shadow: none;
}

.nav-compass .nav-source-text {
  fill: rgba(218, 245, 250, 0.8);
  font: 900 8px/1 ui-monospace, monospace;
  letter-spacing: 0.08em;
  text-anchor: middle;
}

.nav-popup-grid,
.weather-detail-grid {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
  padding: 0 14px 12px;
  font-size: 12px;
}

.nav-popup-grid dt,
.weather-detail-grid dt {
  color: rgba(224, 240, 246, 0.76);
  font-weight: 950;
  text-transform: uppercase;
}

.nav-popup-grid dd,
.weather-detail-grid dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: #f8fdff;
  font-weight: 850;
}

.popup-weather {
  margin: 0 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
}

.popup-weather.good {
  border-color: rgba(34, 197, 94, 0.58);
  background: rgba(8, 64, 38, 0.46);
}

.popup-weather.bad {
  border-color: rgba(248, 113, 113, 0.76);
  background: rgba(83, 16, 24, 0.56);
}

.popup-weather.watch {
  border-color: rgba(250, 204, 21, 0.62);
  background: rgba(80, 61, 10, 0.44);
}

.weather-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 7px;
}

.weather-head strong {
  color: #fff;
  font-size: 14px;
  font-weight: 950;
}

.weather-head span {
  color: rgba(238, 251, 255, 0.82);
  font-size: 11px;
  font-weight: 900;
}

.weather-detail-grid {
  padding: 0 12px 9px;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 5px 9px;
  font-size: 11px;
}

.popup-weather p {
  margin: 0;
  padding: 0 12px 10px;
  color: rgba(238, 251, 255, 0.72);
  font-size: 10px;
  font-weight: 800;
}

.leaflet-top.leaflet-right {
  top: 14px;
  right: 18px;
  z-index: 650;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.leaflet-top.leaflet-right .map-cursor-control {
  order: -1;
  float: none;
  clear: none;
}

.leaflet-control-layers {
  border: 1px solid var(--line) !important;
  border-radius: 8px;
  box-shadow: 0 14px 38px rgba(17, 34, 46, 0.14);
  background: var(--panel) !important;
  overflow: hidden;
}

.leaflet-control-layers-expanded {
  padding: 8px 10px;
  color: var(--ink);
  background: var(--panel);
  font-size: 12px;
  font-weight: 700;
  max-height: min(460px, calc(100vh - 150px));
  overflow-y: auto;
}

.leaflet-control-layers-toggle {
  width: 34px !important;
  height: 34px !important;
}

.map-cursor-control {
  width: 238px;
  margin-top: 0 !important;
  margin-bottom: 8px !important;
  padding: 10px 12px 9px;
  border: 1px solid rgba(20, 211, 197, 0.72);
  border-left: 4px solid #12d3c5;
  border-radius: 7px;
  color: #eefcff;
  background: rgba(4, 24, 34, 0.92);
  box-shadow: 0 14px 34px rgba(0, 12, 19, 0.28);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.map-cursor-control span,
.map-cursor-control strong,
.map-cursor-control small,
.map-cursor-control em {
  display: block;
  letter-spacing: 0;
}

.map-cursor-control span {
  margin-bottom: 4px;
  color: #75e9df;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.map-cursor-control strong {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 15px;
  line-height: 1.25;
}

.map-cursor-control small {
  margin-top: 4px;
  color: rgba(238, 252, 255, 0.76);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 10px;
  line-height: 1.35;
}

.map-cursor-control em {
  margin-top: 5px;
  color: rgba(117, 233, 223, 0.72);
  font-size: 8px;
  font-style: normal;
  font-weight: 900;
}

.popup-title {
  margin: 0 0 7px;
  font-weight: 800;
}

.popup-data {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 12px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(520px, 62vh) auto;
    height: auto;
    min-height: 100vh;
  }

  .side-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .topbar {
    align-items: stretch;
    gap: 10px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .track-toolbar {
    top: 96px;
    right: 18px;
    max-width: none;
  }
}

@media (max-width: 560px) {
  .shell {
    grid-template-rows: minmax(500px, 66vh) auto;
  }

  .topbar {
    left: 8px;
    right: auto;
    top: 8px;
    width: min(calc(100vw - 16px), 374px);
    flex-direction: column;
    gap: 7px;
  }

  .eyebrow {
    margin-bottom: 2px;
    font-size: 10px;
  }

  .topbar h1 {
    font-size: 22px;
  }

  .top-actions {
    width: 100%;
    max-width: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .icon-btn {
    min-width: 0;
    width: 100%;
    height: 32px;
    padding: 0 6px;
    font-size: 13px;
  }

  .track-toolbar {
    top: 118px;
    left: 8px;
    right: auto;
    width: min(calc(100vw - 16px), 374px);
    max-width: min(calc(100vw - 16px), 374px);
    gap: 6px;
    padding: 6px;
  }

  .track-presets {
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 5px;
  }

  .track-btn {
    min-width: 0;
    width: 100%;
    height: 28px;
    padding: 0 4px;
    font-size: 11px;
  }

  .track-status {
    width: 100%;
    text-align: center;
  }

  .legend {
    left: 8px;
    right: auto;
    width: min(calc(100vw - 16px), 374px);
    bottom: 8px;
    gap: 7px;
    justify-content: center;
    padding: 7px 8px;
    font-size: 11px;
  }

  .meteo-legend {
    right: 10px;
    bottom: 72px;
    width: calc(100% - 20px);
  }

  .leaflet-top.leaflet-right {
    top: 226px;
    right: 8px;
  }

  .side-panel {
    width: 100%;
    max-width: 100vw;
    padding: 10px;
  }

  .status-pill {
    min-width: 58px;
    height: 24px;
    padding: 0 8px;
    font-size: 10px;
  }

  .vessel-card,
  .detail-panel {
    padding: 11px;
  }

  .vessel-card {
    grid-template-columns: 1fr;
  }

  .vessel-card .status-pill {
    justify-self: start;
  }

  .ship-info-box {
    display: none;
  }

  .data-grid,
  .metric-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .topbar.compact-bar {
    right: auto;
    flex-wrap: nowrap;
  }

  .topbar.compact-bar .top-actions {
    flex: 0 0 auto;
    justify-content: stretch;
  }

  .measure-panel {
    top: 176px;
    left: 200px;
    max-height: calc(100vh - 200px);
  }

  .range-ring-panel {
    top: 176px;
    left: auto;
    right: 12px;
    max-height: calc(100vh - 200px);
  }

  .zones-panel {
    top: 176px;
    left: auto;
    right: 12px;
    max-height: calc(100vh - 200px);
  }

  .leaflet-top.leaflet-right {
    top: 156px;
  }

  .speed-color-panel {
    top: auto;
    bottom: 14px;
    transform: none;
  }
}

@media (max-width: 560px) {
  .map-cursor-control {
    width: min(212px, calc(100vw - 92px));
    padding: 8px 9px;
  }

  .map-cursor-control strong {
    font-size: 13px;
  }

  .map-cursor-control small {
    font-size: 9px;
  }

  .topbar.compact-bar {
    left: 8px;
    right: 8px;
    bottom: auto;
    width: auto;
    max-height: min(46vh, 360px);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .compact-brand {
    width: auto;
    min-height: 30px;
  }

  .compact-brand span {
    font-size: 12px;
  }

  .topbar.compact-bar .top-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }

  .topbar.compact-bar .track-presets {
    flex: 1 1 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 100%;
  }

  .topbar.compact-bar .track-btn,
  .topbar.compact-bar .icon-btn {
    width: 100%;
    min-width: 0;
  }

  .topbar.compact-bar .bar-divider {
    display: none;
  }

  .topbar.compact-bar .track-status {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
  }

  .measure-panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: min(72vh, 560px);
  }

  .range-ring-panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: min(64vh, 420px);
  }

  .zones-panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: min(64vh, 420px);
  }

  .measure-summary {
    grid-template-columns: 1fr;
  }

  .speed-color-panel {
    left: 8px;
    bottom: 8px;
    max-width: calc(100vw - 16px);
    grid-template-columns: repeat(2, auto);
  }

  .speed-color-panel strong {
    grid-column: 1 / -1;
  }

  .fleet-ticker {
    top: 262px;
    right: 8px;
    bottom: auto;
    left: 8px;
    height: 40px;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 7px;
    padding: 5px 6px;
  }

  .fleet-ticker-label {
    height: 26px;
    padding: 0 7px;
    font-size: 9px;
  }

  .ticker-item {
    gap: 6px;
    font-size: 11px;
  }

  .ticker-item strong {
    font-size: 12px;
  }

  body.tv-mode .tv-mode-panel {
    top: 8px;
    right: 8px;
    left: 8px;
  }

  body.tv-mode .tv-mode-head {
    min-height: 48px;
    padding: 8px;
  }

  body.tv-mode .tv-mode-head span {
    font-size: 10px;
  }

  body.tv-mode .tv-mode-head strong {
    font-size: 18px;
  }

  body.tv-mode .tv-mode-actions button {
    height: 32px;
    padding: 0 9px;
    font-size: 10px;
  }

  body.tv-mode .tv-vessel-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: calc(100vh - 132px);
    overflow: hidden;
  }

  body.tv-mode .tv-vessel-card {
    min-height: 108px;
    padding: 10px;
  }

  body.tv-mode .tv-vessel-card:nth-child(n+3) {
    display: none;
  }

  body.tv-mode .tv-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    margin-top: 8px;
  }

  body.tv-mode .tv-card-foot {
    grid-template-columns: 1fr 1fr;
    margin-top: 7px;
    font-size: 10px;
  }

  body.tv-mode .fleet-ticker {
    top: auto;
    right: 8px;
    bottom: 8px;
    left: 8px;
    height: 44px;
  }

  .leaflet-top.leaflet-right {
    top: 188px;
  }

  .map-vessel-panel {
    top: 196px;
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
  }

  .map-vessel-panel .nav-compass {
    height: 152px;
  }

  .map-vessel-panel .nav-compass svg {
    height: 152px;
  }
}

.shell {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: 1fr !important;
  height: 100vh;
}

.map-panel {
  min-height: 100vh;
}
.ais-layer-btn {
  border-color: rgba(56, 189, 248, .7) !important;
}

.ais-layer-btn b {
  min-width: 18px;
  display: inline-block;
  margin-left: 3px;
  color: #7dd3fc;
}

.ais-receiver-btn b {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 4px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 2px rgba(100, 116, 139, .18);
}

.ais-receiver-btn b.online {
  background: #22c55e;
  box-shadow: 0 0 9px rgba(34, 197, 94, .85);
}

.ais-receiver-btn b.offline {
  background: #ef4444;
  box-shadow: 0 0 9px rgba(239, 68, 68, .65);
}

.ais-receiver-panel {
  position: absolute;
  z-index: 840;
  top: 78px;
  right: 18px;
  width: min(390px, calc(100% - 36px));
  padding: 14px;
  border: 1px solid rgba(56, 189, 248, .35);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(4, 17, 32, .97), rgba(8, 29, 49, .95));
  color: #dbeafe;
  box-shadow: 0 20px 55px rgba(0, 0, 0, .48);
  backdrop-filter: blur(14px);
}

.ais-receiver-panel.hidden { display: none; }

.ais-settings-panel {
  position: absolute;
  z-index: 845;
  top: 78px;
  right: 18px;
  width: min(390px, calc(100vw - 36px));
  overflow: hidden;
  color: #e7f7fb;
  border: 1px solid rgba(34, 211, 238, .42);
  border-radius: 8px;
  background: rgba(3, 20, 30, .96);
  box-shadow: 0 20px 55px rgba(0, 0, 0, .52);
  backdrop-filter: blur(16px);
}

.ais-settings-panel.hidden { display: none; }

.ais-settings-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 8px 10px 8px 13px;
  border-bottom: 1px solid rgba(34, 211, 238, .22);
  background: rgba(8, 47, 60, .72);
}

.ais-settings-panel header div { display: grid; gap: 2px; }
.ais-settings-panel header span { color: #67e8f9; font: 900 9px/1.1 ui-monospace, monospace; letter-spacing: .08em; }
.ais-settings-panel header strong { color: #fff; font-size: 17px; }
.ais-settings-panel header button {
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  color: #c9edf4; border: 1px solid rgba(103, 232, 249, .3); border-radius: 6px;
  background: rgba(2, 16, 24, .72); font-size: 23px; cursor: pointer;
}

.ais-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 10px;
}

.ais-settings-grid label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-height: 50px;
  padding: 8px;
  border: 1px solid rgba(100, 181, 204, .22);
  border-radius: 6px;
  background: rgba(7, 38, 50, .68);
  cursor: pointer;
}

.ais-settings-grid input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: #22d3ee; }
.ais-settings-grid label span { display: grid; min-width: 0; gap: 3px; }
.ais-settings-grid label b { color: #f1fbfd; font-size: 11px; }
.ais-settings-grid label small { color: #86aab5; font-size: 9px; line-height: 1.25; }

.ais-settings-selects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 10px 10px;
}

.ais-settings-selects label { display: grid; gap: 4px; color: #8fb9c4; font: 900 9px ui-monospace, monospace; text-transform: uppercase; }
.ais-settings-selects select {
  width: 100%; height: 34px; padding: 0 8px; color: #f4fbfd;
  border: 1px solid #285264; border-radius: 5px; background: #06131c; font-weight: 800;
}

.ais-settings-panel footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 10px; border-top: 1px solid rgba(34, 211, 238, .18); background: rgba(2, 15, 23, .72);
}
.ais-settings-panel footer button { min-height: 31px; padding: 0 10px; color: #d9f7fb; border: 1px solid #285264; border-radius: 5px; background: #0b2a38; font-weight: 800; cursor: pointer; }
.ais-settings-panel footer span { color: #67e8f9; font: 800 9px ui-monospace, monospace; }

@media (max-width: 680px) {
  .ais-settings-panel { top: 58px; right: 8px; width: min(360px, calc(100vw - 16px)); max-height: calc(100vh - 72px); overflow-y: auto; }
  .ais-settings-grid { grid-template-columns: 1fr; }
  .ais-settings-grid label { min-height: 44px; }
}

.ais-receiver-panel > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ais-receiver-panel > header div {
  display: grid;
  gap: 3px;
}

.ais-receiver-panel > header span {
  color: #38bdf8;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
}

.ais-receiver-panel > header strong {
  color: #f8fafc;
  font-size: 14px;
}

.ais-receiver-panel > header button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, .3);
  border-radius: 8px;
  background: rgba(15, 23, 42, .7);
  color: #cbd5e1;
  font-size: 20px;
  cursor: pointer;
}

.ais-rx-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ais-rx-grid article {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(148, 163, 184, .16);
  border-radius: 9px;
  background: rgba(15, 23, 42, .58);
}

.ais-rx-grid span,
.ais-rx-saving span {
  color: #94a3b8;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.ais-rx-grid strong {
  overflow: hidden;
  color: #f8fafc;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ais-rx-saving {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding: 11px;
  border: 1px solid rgba(34, 197, 94, .25);
  border-radius: 10px;
  background: rgba(6, 78, 59, .18);
}

.ais-rx-saving > div:first-child {
  display: flex;
  justify-content: space-between;
}

.ais-rx-saving strong { color: #4ade80; }
.ais-rx-saving small { color: #a7f3d0; }

.ais-rx-saving-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 23, 42, .8);
}

.ais-rx-saving-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0ea5e9, #22c55e);
  transition: width .35s ease;
}

.ais-rx-device {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  margin: 11px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, .18);
  font-size: 11px;
}

.ais-rx-device dt { color: #64748b; }
.ais-rx-device dd {
  margin: 0;
  color: #cbd5e1;
  text-align: right;
}

.ais-legend {
  position: absolute;
  z-index: 720;
  left: 224px;
  bottom: 66px;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 5px 12px;
  padding: 10px 12px;
  border: 1px solid rgba(125, 211, 252, .28);
  border-radius: 10px;
  background: rgba(5, 16, 30, .88);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
  color: #dbeafe;
  font: 600 11px/1.2 Inter, system-ui, sans-serif;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.ais-legend.hidden { display: none; }

.ais-legend strong {
  grid-column: 1 / -1;
  color: #7dd3fc;
  letter-spacing: .03em;
  margin-bottom: 2px;
}

.ais-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.ais-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ais-color);
  border: 1px solid rgba(255, 255, 255, .72);
  box-shadow: none;
}

.ais-legend .ais-legend-status b {
  display: grid;
  width: 14px;
  height: 14px;
  place-items: center;
  border: 1px solid #eab308;
  border-radius: 50%;
  color: #fde68a;
  background: #071923;
  font: 900 8px/1 Inter, system-ui, sans-serif;
}

.ais-legend .ais-legend-status b.moored {
  border-color: #3b82f6;
  color: #bfdbfe;
}

.ais-legend .ais-legend-status b .fa-anchor {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: 8px;
}

.ais-legend > small {
  grid-column: 1 / -1;
  max-width: 300px;
  padding-top: 3px;
  border-top: 1px solid rgba(125, 211, 252, .18);
  color: #94a3b8;
  font-size: 9px;
}

.ais-focus-panel {
  position: absolute;
  z-index: 845;
  left: 50%;
  bottom: 70px;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  width: min(610px, calc(100% - 430px));
  min-width: 430px;
  padding: 9px 10px;
  border: 1px solid rgba(85, 246, 255, .72);
  border-radius: 11px;
  background: linear-gradient(110deg, rgba(3, 18, 29, .96), rgba(8, 42, 56, .94));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 12px 34px rgba(0, 0, 0, .42), 0 0 24px rgba(0, 212, 255, .14);
  color: #f8fdff;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
}

.ais-focus-panel.hidden { display: none; }
.ais-focus-flag-slot { display: grid; width: 25px; place-items: center; }
.ais-focus-copy { display: grid; min-width: 0; gap: 1px; }
.ais-focus-copy small { color: #55f6ff; font: 800 8px/1.1 Inter, system-ui, sans-serif; letter-spacing: .13em; }
.ais-focus-copy strong { overflow: hidden; color: #ffffff; font: 850 13px/1.2 Inter, system-ui, sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.ais-focus-copy em { overflow: hidden; color: #bdefff; font: 650 9px/1.2 Inter, system-ui, sans-serif; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.ais-focus-age { color: #74f7c5; font: 750 8px/1.2 Inter, system-ui, sans-serif; font-style: normal; }
.ais-focus-age.aging { color: #ffd43b; }
.ais-focus-age.stale,
.ais-focus-age.unknown { color: #aab8c8; }
.ais-focus-panel button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 31px;
  padding: 0 10px;
  border: 1px solid rgba(85, 246, 255, .42);
  border-radius: 7px;
  background: rgba(8, 63, 79, .82);
  color: #d9fbff;
  font: 800 10px/1 Inter, system-ui, sans-serif;
  cursor: pointer;
}
.ais-focus-panel button:hover,
.ais-focus-panel button.active { border-color: #55f6ff; background: #00a9c7; color: #03131b; box-shadow: 0 0 14px rgba(85, 246, 255, .34); }
#aisFocusClear { width: 31px; padding: 0; font-size: 19px; }

.ais-vessel-icon {
  --ais-saturation: 1.22;
  --ais-brightness: 1.06;
  --ais-contrast: 1.08;
  --ais-alpha: 1;
  --ais-glow: rgba(0, 212, 255, .28);
  background: transparent;
  border: 0;
  overflow: visible !important;
}

.ais-vessel-symbol {
  position: absolute;
  left: 0;
  top: 0;
  width: 56px;
  height: 42px;
  transform: scale(var(--ais-marker-scale, var(--ais-icon-scale, 1)));
  transform-origin: 50% 50%;
  transition: transform 180ms ease;
}

.ais-vessel-symbol::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 8px;
  width: 42px;
  height: 26px;
  box-sizing: border-box;
  border: 2px solid var(--ais-color, #aab8c8);
  border-radius: 14px;
  background: rgba(2, 15, 23, .80);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .34), 0 1px 5px rgba(2, 6, 23, .92), 0 0 8px color-mix(in srgb, var(--ais-color, #aab8c8) 52%, transparent);
  opacity: .96;
}

.ais-vessel-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 56px;
  height: 42px;
  pointer-events: none;
  transform: scale(var(--ais-marker-scale, var(--ais-icon-scale, 1)));
  transform-origin: 50% 50%;
  transition: transform 180ms ease;
}

.ais-vessel-sprite {
  position: absolute;
  left: 0;
  top: 5.5px;
  width: 56px;
  height: 31px;
  background-image: url("./assets/ais-vessels-top-view.png");
  background-repeat: no-repeat;
  background-size: 279.6px 209.7px;
  filter: saturate(var(--ais-saturation)) brightness(var(--ais-brightness)) contrast(var(--ais-contrast)) opacity(var(--ais-alpha)) drop-shadow(0 1px 1px rgba(2, 6, 23, .84)) drop-shadow(0 0 2px var(--ais-glow));
  transform: rotate(calc(var(--ais-heading) - 90deg));
  transform-origin: 50% 50%;
  transition: filter 140ms ease, transform 220ms linear;
  z-index: 1;
}

.ais-sprite-container { background-position: 0 -13.5px; }
.ais-sprite-dry-cargo { background-position: -55.8px -13.5px; }
.ais-sprite-cargo { background-position: -55.8px -13.5px; }
.ais-sprite-tanker { background-position: -223.6px -13.5px; }
.ais-sprite-passenger { background-position: -55.8px -45.4px; }
.ais-sprite-service { background-position: -55.8px -80.1px; }
.ais-sprite-fishing { background-position: 0 -80.1px; }
.ais-sprite-pleasure { background-position: -55.8px -115.9px; }
.ais-sprite-other { background-position: -111.8px -45.4px; }
.ais-sprite-unknown { background-position: -167.8px -151.6px; }

.ais-flag-badge,
.ais-popup-flag,
.ais-focus-flag {
  display: inline-block;
  width: 20px;
  height: 15px;
  box-sizing: content-box;
  background-image: url("./assets/ais-flag-sprite-v64.png");
  background-repeat: no-repeat;
  background-position: var(--ais-flag-x) var(--ais-flag-y);
  background-size: 320px 255px;
  border: 1px solid rgba(248, 250, 252, .92);
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(2, 6, 23, .88);
}

.ais-flag-badge {
  position: absolute;
  left: -1px;
  top: -2px;
}

.ais-lod-overview .ais-flag-badge,
.ais-lod-overview .ais-status-badge,
.ais-lod-overview .ais-age-badge,
.ais-lod-operational .ais-flag-badge {
  display: none;
}

.ais-lod-operational .ais-vessel-icon:hover .ais-flag-badge,
.ais-lod-operational .ais-focused .ais-flag-badge {
  display: inline-block;
}

.ais-lod-operational .ais-identity-visible:not(.ais-density-overlap) .ais-flag-badge {
  display: inline-block;
}

.ais-lod-detail .ais-vessel-symbol::before {
  opacity: .34;
  border-width: 1px;
}

.ais-focus-flag { transform: scale(.92); }

.ais-status-badge {
  position: absolute;
  right: 0;
  bottom: 2px;
  display: grid;
  min-width: 13px;
  height: 12px;
  padding: 0 2px;
  place-items: center;
  color: #f8fafc;
  border: 1px solid #94a3b8;
  border-radius: 3px;
  background: #071923;
  box-shadow: 0 1px 2px rgba(2, 6, 23, .72);
  font: 900 7px/1 Arial, sans-serif;
}
.ais-status-badge.anchor {
  width: 14px;
  min-width: 14px;
  height: 14px;
  padding: 0;
  color: #fde68a;
  border-color: #eab308;
  border-radius: 50%;
}
.ais-status-badge.anchor .fa-anchor { font-size: 9px; line-height: 1; }
.ais-status-badge.moored { color: #bfdbfe; border-color: #3b82f6; }
.ais-status-badge.restricted { color: #1b1100; border-color: #ffd43b; background: #ff9f1c; }
.ais-status-badge.distress { color: #ffffff; border-color: #ff8aa3; background: #ff1744; box-shadow: 0 0 9px rgba(255, 23, 68, .72); }
.ais-nav-underway { --ais-glow: rgba(0, 212, 255, .34); }
.ais-nav-anchor { --ais-glow: rgba(255, 212, 59, .42); }
.ais-nav-moored { --ais-glow: rgba(77, 163, 255, .42); }
.ais-nav-restricted { --ais-glow: rgba(255, 159, 28, .72); --ais-contrast: 1.14; }
.ais-target-distress { --ais-saturation: 1.38; --ais-brightness: 1.14; --ais-contrast: 1.16; --ais-alpha: 1; --ais-glow: rgba(255, 23, 68, .92); }
.ais-vessel-icon:hover { --ais-saturation: 1.34; --ais-brightness: 1.14; --ais-contrast: 1.12; }

.ais-age-aging { --ais-saturation: 1.02; --ais-brightness: .94; --ais-alpha: .88; --ais-glow: rgba(255, 159, 28, .52); }
.ais-age-stale { --ais-saturation: .46; --ais-brightness: .78; --ais-contrast: .96; --ais-alpha: .58; --ais-glow: rgba(142, 161, 181, .24); }
.ais-age-unknown { --ais-saturation: .62; --ais-brightness: .84; --ais-alpha: .68; --ais-glow: rgba(170, 184, 200, .26); }
.ais-target-distress.ais-age-aging,
.ais-target-distress.ais-age-stale,
.ais-target-distress.ais-age-unknown { --ais-saturation: 1.38; --ais-brightness: 1.14; --ais-contrast: 1.16; --ais-alpha: 1; }

.ais-age-badge {
  position: absolute;
  top: -1px;
  right: -1px;
  display: grid;
  width: 8px;
  height: 8px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .88);
  border-radius: 50%;
  color: transparent;
  background: #8ea1b5;
  box-shadow: 0 1px 3px rgba(2, 6, 23, .86);
  font: 900 0/1 Inter, system-ui, sans-serif;
}
.ais-age-badge.aging { background: #ff9f1c; }
.ais-age-badge.stale { background: #65778b; }
.ais-age-badge.unknown { background: #334155; }
.ais-icon-detail-on .ais-age-badge {
  top: -2px;
  right: -2px;
  width: auto;
  min-width: 18px;
  height: 13px;
  padding: 0 3px;
  border-radius: 4px;
  color: #ffffff;
  font-size: 7px;
}

.ais-lod-operational .ais-age-badge {
  top: 1px;
  right: 1px;
}

.ais-icon-compact .ais-vessel-symbol,
.ais-icon-compact .ais-vessel-overlay {
  left: 0;
  top: 0;
  width: 56px;
  height: 42px;
  transform: scale(var(--ais-marker-scale, var(--ais-icon-scale, 0.72)));
  transform-origin: 50% 50%;
}

.ais-icon-compact .ais-status-badge,
.ais-icon-compact .ais-flag-badge,
.ais-icon-compact .ais-age-badge {
  display: none;
}

.ais-density-overlap { --ais-saturation: 1.28; --ais-contrast: 1.12; }

.ais-density-overlap .ais-flag-badge,
.ais-density-overlap .ais-age-badge { display: none; }

.ais-density-overlap:not(.ais-focused) .ais-vessel-symbol::before {
  opacity: .74;
}

.ais-focused {
  --ais-saturation: 1.42;
  --ais-brightness: 1.16;
  --ais-contrast: 1.16;
  --ais-alpha: 1;
  --ais-glow: rgba(85, 246, 255, .96);
}

.ais-focused .ais-vessel-overlay::after {
  content: "";
  position: absolute;
  inset: -4px -5px;
  border: 2px solid #55f6ff;
  border-radius: 15px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .82), 0 0 0 1px rgba(2, 15, 23, .95), 0 0 13px rgba(85, 246, 255, .82);
}

.ais-focus-mode .ais-unfocused:not(.ais-target-distress) {
  --ais-saturation: .46;
  --ais-brightness: .70;
  --ais-contrast: .90;
  --ais-glow: transparent;
}

.ais-focused .ais-vessel-label {
  display: block !important;
  border-color: rgba(85, 246, 255, .88);
  background: rgba(2, 22, 33, .96);
  box-shadow: 0 0 13px rgba(85, 246, 255, .26);
}

.ais-vessel-icon:hover .ais-vessel-label {
  display: block;
  border-color: color-mix(in srgb, var(--ais-color, #55f6ff) 72%, white);
  background: rgba(2, 22, 33, .96);
  box-shadow: 0 0 11px rgba(2, 6, 23, .74);
}

.ais-icon-compact .ais-focused .ais-flag-badge,
.ais-focused.ais-density-overlap .ais-flag-badge { display: inline-block; }

.ais-anchor-symbol {
  top: 3px;
  width: 32px;
  height: 32px;
  transform: none;
  filter: drop-shadow(0 1px 1px rgba(2, 6, 23, .92));
}

.ais-anchor-symbol .ais-anchor-disc {
  fill: color-mix(in srgb, var(--ais-color) 78%, #07111f);
  stroke: #f8fafc;
  stroke-width: 1.35;
}

.ais-anchor-symbol .ais-anchor-eye {
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.8;
}

.ais-anchor-symbol .ais-anchor-mark {
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ais-target-at-anchor .ais-vessel-label::before {
  content: "ANCHOR";
  margin-right: 5px;
  color: #facc15;
  font-size: 8px;
  font-weight: 900;
}

.ais-target-moored .ais-vessel-label::before {
  content: "MOORED";
  margin-right: 5px;
  color: #60a5fa;
  font-size: 8px;
  font-weight: 900;
}

.ais-nav-restricted .ais-vessel-label::before {
  content: "RESTRICTED";
  margin-right: 5px;
  color: #ffb84d;
  font-size: 8px;
  font-weight: 900;
}

.ais-vessel-label {
  display: none;
  position: absolute;
  left: 50px;
  top: 8px;
  max-width: 210px;
  overflow: hidden;
  padding: 3px 6px;
  border: 1px solid rgba(148, 163, 184, .35);
  border-radius: 4px;
  background: rgba(2, 6, 23, .82);
  color: #f8fafc;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 700 10px/1.15 Inter, system-ui, sans-serif;
  text-shadow: 0 1px 2px #000;
}

.ais-vessel-label b {
  display: inline-block;
  max-width: 145px;
  overflow: hidden;
  vertical-align: middle;
  text-overflow: ellipsis;
}

.ais-vessel-label em {
  display: inline-block;
  margin-left: 5px;
  color: #7dd3fc;
  font-style: normal;
  vertical-align: middle;
}

.ais-labels-on:not(.ais-lod-operational) .ais-vessel-label { display: block; }
.ais-labels-on.ais-lod-operational .ais-identity-visible:not(.ais-density-overlap) .ais-vessel-label { display: block; }
.ais-true-scale-on .ais-vessel-icon.has-true-scale .ais-vessel-symbol { display: none; }

.ais-popup {
  min-width: 235px;
  color: #dbeafe;
}

.ais-popup header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, .25);
}

.ais-popup header i {
  width: 12px;
  height: 26px;
  clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%);
  background: var(--ais-color);
}

.ais-popup header div { display: grid; gap: 2px; }
.ais-popup header strong { color: #f8fafc; font-size: 14px; }
.ais-popup header span { color: #94a3b8; font-size: 11px; }
.ais-popup dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 0;
}
.ais-popup dt { color: #94a3b8; }
.ais-popup dd { margin: 0; color: #e2e8f0; text-align: right; font-weight: 700; }
.ais-popup .ais-popup-flag-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}
.ais-popup-flag {
  flex: 0 0 auto;
  vertical-align: middle;
  transform: scale(.86);
}
.ais-popup-age.fresh { color: #74f7c5; }
.ais-popup-age.aging { color: #ffd43b; }
.ais-popup-age.stale,
.ais-popup-age.unknown { color: #aab8c8; }
.ais-leaflet-popup .leaflet-popup-content-wrapper,
.ais-leaflet-popup .leaflet-popup-tip { background: #07111f; }
.ais-leaflet-popup .leaflet-popup-content { margin: 12px 14px; }

@media (max-width: 760px) {
  .ais-focus-panel {
    bottom: 68px;
    width: calc(100% - 16px);
    min-width: 0;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 7px;
  }
  .ais-focus-copy em { display: none; }
  .ais-focus-panel button { padding: 0 7px; }
  .ais-legend {
    left: 8px;
    bottom: 68px;
    grid-template-columns: auto;
    max-height: 150px;
    overflow: hidden;
  }
  .ais-legend strong { grid-column: 1; }
  .speed-color-panel { display: none; }
  .ais-receiver-panel {
    top: 66px;
    right: 8px;
    width: calc(100% - 16px);
    max-height: calc(100% - 82px);
    overflow-y: auto;
  }
}

/* Ocean risk operations drawer */
.ocean-risk-btn b {
  min-width: 22px;
  padding: 2px 5px;
  border-radius: 4px;
  background: #dbeafe;
  color: #1d4ed8;
}
.ocean-risk-btn.risk-watch { border-color: #22c55e; box-shadow: inset 0 -3px 0 #22c55e; }
.ocean-risk-btn.risk-high { border-color: #eab308; box-shadow: inset 0 -3px 0 #eab308; }
.ocean-risk-btn.risk-critical { border-color: #ef4444; box-shadow: inset 0 -3px 0 #ef4444; }
.ocean-risk-btn.risk-critical b { background: #fee2e2; color: #b91c1c; }

.ocean-risk-panel {
  position: absolute;
  z-index: 1190;
  top: 76px;
  right: 18px;
  width: min(500px, calc(100% - 36px));
  max-height: calc(100% - 94px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(7, 31, 43, 0.97);
  color: #eaf8fb;
  border: 1px solid #1d6675;
  border-top: 4px solid #16c7d7;
  border-radius: 8px;
  box-shadow: 0 22px 50px rgba(2, 15, 23, 0.42);
  backdrop-filter: blur(12px);
}
.ocean-risk-panel.hidden { display: none; }
.ocean-risk-head {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px 13px;
  background: rgba(7, 31, 43, 0.98);
  border-bottom: 1px solid #245563;
}
.ocean-risk-head .eyebrow { margin: 0 0 4px; color: #5ee7f2; font-size: 10px; }
.ocean-risk-head h2 { margin: 0; font-size: 21px; line-height: 1.1; letter-spacing: 0; }
.ocean-risk-head span { display: block; margin-top: 5px; color: #91aeb7; font: 700 10px/1.25 ui-monospace, monospace; }
.ocean-risk-head-actions { display: flex; gap: 5px; }
.ocean-risk-head-actions button,
.ocean-risk-alert-card footer button {
  min-height: 32px;
  border: 1px solid #2f6978;
  border-radius: 5px;
  background: #0b3e4d;
  color: #eaffff;
  font: 800 11px/1 Arial, sans-serif;
  cursor: pointer;
}
.ocean-risk-head-actions button { padding: 0 9px; }
.ocean-risk-head-actions button:last-child { width: 32px; padding: 0; font-size: 20px; }
.ocean-risk-head-actions button:hover,
.ocean-risk-alert-card footer button:hover { border-color: #53ddeb; background: #0b5364; }
.ocean-risk-head-actions button.is-loading { opacity: 0.55; cursor: progress; }

.ocean-risk-time {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding: 10px 12px;
  background: #061923;
  border-bottom: 1px solid #214956;
}
.risk-time-btn {
  min-height: 34px;
  border: 1px solid #244d5a;
  border-radius: 4px;
  background: #0b2b37;
  color: #a7c3cb;
  font: 900 11px/1 Arial, sans-serif;
  cursor: pointer;
}
.risk-time-btn.active { background: #0d8298; border-color: #5ee7f2; color: #fff; }

.ocean-risk-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 11px 12px 5px;
}
.ocean-risk-metrics article {
  min-width: 0;
  padding: 9px 10px;
  background: #0b2b37;
  border: 1px solid #28515e;
  border-left: 3px solid #17c5d5;
  border-radius: 5px;
}
.ocean-risk-metrics span,
.ocean-risk-card-grid span {
  display: block;
  color: #7fa1aa;
  font: 800 9px/1.2 ui-monospace, monospace;
  text-transform: uppercase;
}
.ocean-risk-metrics strong { display: block; margin-top: 3px; color: #fff; font-size: 22px; }
.ocean-risk-section { padding: 8px 12px 2px; }
.ocean-risk-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.ocean-risk-section-title h3 { margin: 0; color: #fff; font-size: 14px; }
.ocean-risk-section-title span { color: #7898a2; font: 700 9px ui-monospace, monospace; }
.ocean-risk-vessels,
.ocean-risk-alerts { display: grid; gap: 8px; }
.ocean-risk-empty { margin: 0; padding: 16px; border: 1px dashed #37616c; color: #8daab2; text-align: center; }

.ocean-risk-vessel-card {
  border: 1px solid #315d69;
  border-left: 5px solid #64748b;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(15, 62, 75, 0.9), rgba(7, 30, 42, 0.98));
  padding: 11px;
  cursor: pointer;
}
.ocean-risk-vessel-card:hover { transform: translateY(-1px); border-color: #52cddd; box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.ocean-risk-vessel-card.risk-zone-green { border-left-color: #2dd4bf; }
.ocean-risk-vessel-card.risk-zone-yellow { border-left-color: #facc15; }
.ocean-risk-vessel-card.risk-zone-red { border-left-color: #fb4f63; }
.ocean-risk-vessel-card > header { display: flex; justify-content: space-between; gap: 10px; }
.ocean-risk-vessel-card > header > div:first-child { min-width: 0; }
.ocean-risk-vessel-card > header strong { display: block; overflow-wrap: anywhere; color: #fff; font-size: 16px; }
.ocean-risk-vessel-card > header span { color: #91aeb7; font: 700 10px/1.25 ui-monospace, monospace; }
.ocean-risk-vessel-card > header > div:last-child { display: flex; align-items: flex-start; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.risk-zone-badge,
.ocean-risk-timeline span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border-radius: 4px;
  padding: 4px 6px;
  font: 900 9px/1 ui-monospace, monospace;
  white-space: nowrap;
}
.risk-zone-outside { background: #263e49 !important; color: #bdd0d6 !important; }
.risk-zone-green { background: #064e3b !important; color: #6ee7b7 !important; }
.risk-zone-yellow { background: #5b4708 !important; color: #fde047 !important; }
.risk-zone-red { background: #611827 !important; color: #fda4af !important; }
.ocean-risk-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 9px; }
.ocean-risk-card-grid > div { min-width: 0; padding: 7px; background: rgba(3, 22, 31, 0.66); border: 1px solid #214754; border-radius: 4px; }
.ocean-risk-card-grid b { display: block; margin-top: 3px; color: #f7fdff; font-size: 11px; overflow-wrap: anywhere; }
.ocean-risk-card-grid small { display: block; margin-top: 2px; color: #7f9ca5; font-size: 8px; overflow-wrap: anywhere; }
.ocean-risk-timeline { display: flex; gap: 4px; overflow-x: auto; padding: 8px 0 6px; }
.ocean-risk-confidence { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 7px; color: #9db6bd; font: 700 9px ui-monospace, monospace; }
.ocean-risk-confidence i { height: 6px; overflow: hidden; background: #203d47; border-radius: 3px; }
.ocean-risk-confidence i b { display: block; height: 100%; background: linear-gradient(90deg, #fbbf24, #2dd4bf); }

.ocean-risk-alert-card { padding: 10px; border: 1px solid #315967; border-radius: 6px; background: #09242f; }
.ocean-risk-alert-card.is-closed { opacity: 0.68; }
.ocean-risk-alert-card > header { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
.ocean-risk-alert-card > header b { display: block; color: #fff; font-size: 12px; }
.ocean-risk-alert-card > header small { color: #819da6; font: 700 9px ui-monospace, monospace; }
.ocean-risk-alert-meta { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.ocean-risk-alert-meta span { padding: 4px 6px; background: #0d3542; border-radius: 3px; color: #b9d6dc; font: 700 9px ui-monospace, monospace; }
.ocean-risk-alert-inputs { display: grid; grid-template-columns: .8fr 1.2fr; gap: 5px; }
.ocean-risk-alert-inputs input { width: 100%; min-width: 0; min-height: 34px; border: 1px solid #315b68; border-radius: 4px; background: #061923; color: #fff; padding: 6px 8px; font-size: 11px; }
.ocean-risk-alert-card > p { margin: 7px 0 0; color: #acc4ca; font-size: 10px; }
.ocean-risk-alert-card footer { display: flex; justify-content: flex-end; gap: 5px; margin-top: 8px; }
.ocean-risk-alert-card footer button { padding: 0 9px; }
.ocean-risk-alert-card footer .risk-close-action { border-color: #8f3243; color: #fecdd3; }
.ocean-risk-history { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 12px; padding: 8px; border: 1px solid #2e5360; background: #061923; }
.ocean-risk-history span { color: #62ddea; font: 900 10px ui-monospace, monospace; }
.ocean-risk-history b { color: #afc7cd; font: 700 10px ui-monospace, monospace; }
.ocean-risk-note { margin: 0; padding: 0 12px 14px; color: #78949c; font-size: 9px; line-height: 1.35; }

@media (max-width: 760px) {
  .ocean-risk-panel {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 84vh;
    border-radius: 8px 8px 0 0;
  }
  .ocean-risk-head { padding: 12px; }
  .ocean-risk-head h2 { font-size: 18px; }
  .ocean-risk-card-grid { grid-template-columns: repeat(2, 1fr); }
  .ocean-risk-alert-inputs { grid-template-columns: 1fr; }
}

/* Selected vessel operations drawer */
.map-vessel-panel {
  top: 164px;
  right: 14px;
  bottom: auto;
  width: clamp(330px, 28vw, 390px);
  height: min(64vh, 560px);
  min-width: 320px;
  min-height: 360px;
  max-width: calc(100vw - 28px);
  max-height: calc(100dvh - 178px);
  overflow-y: auto;
  overflow-x: hidden;
  resize: both;
  scrollbar-gutter: stable;
  border: 1px solid rgba(75, 185, 208, 0.58);
  border-top: 4px solid var(--ship-color, #13c7df);
  border-radius: 8px;
  background: rgba(5, 24, 34, 0.97);
  box-shadow: 0 24px 58px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(14px);
}

.map-vessel-panel::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 13px;
  height: 13px;
  border-right: 2px solid rgba(103, 221, 236, 0.72);
  border-bottom: 2px solid rgba(103, 221, 236, 0.72);
  pointer-events: none;
}

.map-vessel-panel::-webkit-scrollbar { width: 10px; }
.map-vessel-panel::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.04); }
.map-vessel-panel::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 5px; background: rgba(128, 199, 213, 0.55); background-clip: padding-box; }

.map-vessel-close {
  position: sticky;
  top: 8px;
  left: auto;
  float: right;
  width: 34px;
  height: 34px;
  margin: 8px 8px -42px 0;
  border-radius: 5px;
  background: #102f3a;
  z-index: 12;
}

.map-vessel-panel .nav-popup-card {
  min-height: 100%;
  overflow: visible;
  border: 0;
  border-left: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  text-shadow: none;
}

.map-vessel-panel .nav-popup-card > header {
  position: sticky;
  top: 0;
  z-index: 8;
  min-height: 64px;
  padding: 10px 48px 9px 12px;
  background: rgba(5, 24, 34, 0.98);
  border-bottom: 1px solid rgba(81, 150, 165, 0.34);
}

.map-vessel-panel .nav-popup-card > header small {
  display: block;
  margin-bottom: 4px;
  color: #67ddec;
  font: 900 9px/1 ui-monospace, monospace;
  letter-spacing: 0.08em;
}

.map-vessel-panel .nav-popup-card > header strong {
  font-size: 18px;
  line-height: 1.08;
}

.map-vessel-panel .nav-popup-card > header span {
  max-width: 285px;
  overflow-wrap: anywhere;
  font-size: 10px;
  line-height: 1.35;
}

.map-vessel-panel .nav-popup-card > header em {
  margin: 1px 0 0;
  border-radius: 4px;
}

.nav-vessel-overview {
  display: grid;
  grid-template-columns: 122px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
  padding: 9px 11px;
  border-bottom: 1px solid rgba(81, 150, 165, 0.26);
}

.map-vessel-panel .nav-vessel-overview .nav-compass,
.map-vessel-panel .nav-vessel-overview .nav-compass svg {
  height: 116px;
}

.map-vessel-panel .nav-vessel-overview .nav-compass {
  overflow: hidden;
  border: 1px solid rgba(103, 221, 236, 0.22);
  border-radius: 6px;
  background: radial-gradient(circle at 50% 48%, rgba(84, 193, 211, 0.18), transparent 46%), rgba(4, 18, 27, 0.72);
}

.nav-primary-metrics {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
}

.nav-primary-metrics > div {
  min-width: 0;
  padding: 6px 7px;
  border-left: 3px solid #23c8d9;
  background: rgba(13, 52, 65, 0.72);
}

.nav-primary-metrics span,
.nav-machinery-grid span {
  display: block;
  color: #7fa8b3;
  font: 850 9px/1.1 ui-monospace, monospace;
  text-transform: uppercase;
}

.nav-primary-metrics strong {
  display: block;
  margin-top: 3px;
  color: #fff;
  font-size: 14px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.nav-primary-metrics small {
  display: block;
  margin-top: 2px;
  color: #9ab9c1;
  font-size: 9px;
  overflow-wrap: anywhere;
}

.nav-detail-section {
  padding: 8px 11px 9px;
  border-bottom: 1px solid rgba(81, 150, 165, 0.24);
}

.nav-detail-section h4 {
  margin: 0 0 7px;
  color: #7ce7f1;
  font: 900 10px/1 ui-monospace, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-detail-section h4 span {
  float: right;
  color: #a6c9d1;
  font-size: 8px;
  letter-spacing: 0;
}

.nav-ais-section {
  background: rgba(7, 35, 45, 0.34);
}

.nav-ais-section:not(.unavailable) {
  border-left: 3px solid #22c55e;
}

.map-vessel-panel .ais-detail-grid {
  grid-template-columns: 88px minmax(0, 1fr);
}

.ais-match-empty {
  display: grid;
  gap: 3px;
  padding: 7px 8px;
  border: 1px dashed rgba(129, 172, 183, 0.34);
  background: rgba(5, 22, 31, 0.52);
}

.ais-match-empty strong {
  color: #d4e8ec;
  font-size: 11px;
}

.ais-match-empty small {
  color: #789aa4;
  font-size: 9px;
}

.map-vessel-panel .nav-popup-grid {
  grid-template-columns: 98px minmax(0, 1fr);
  gap: 4px 8px;
  padding: 0;
  font-size: 11px;
}

.map-vessel-panel .nav-popup-grid dt { color: #789aa4; }
.map-vessel-panel .nav-popup-grid dd { color: #f5fbfd; }

.nav-machinery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.nav-machinery-grid > div {
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid rgba(74, 132, 145, 0.28);
  border-radius: 4px;
  background: rgba(7, 35, 45, 0.7);
}

.nav-machinery-grid > div:first-child { border-left: 3px solid #f59e0b; }
.nav-machinery-grid strong {
  display: block;
  margin-top: 4px;
  color: #fff;
  font-size: 13px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.map-vessel-panel .popup-weather {
  margin: 8px 10px 10px;
  border-radius: 5px;
}

.map-vessel-panel .weather-head { padding: 9px 10px; }
.map-vessel-panel .weather-head strong { font-size: 13px; }
.map-vessel-panel .weather-detail-grid { grid-template-columns: 68px minmax(0, 1fr); }

@media (max-width: 760px) {
  .map-vessel-panel {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: none;
    max-height: min(78dvh, 700px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }

  .map-vessel-panel .nav-popup-card > header {
    min-height: 70px;
    padding: 11px 54px 10px 12px;
  }

  .nav-vessel-overview {
    grid-template-columns: 132px minmax(0, 1fr);
    padding: 10px 12px;
  }

  .map-vessel-panel .nav-vessel-overview .nav-compass,
  .map-vessel-panel .nav-vessel-overview .nav-compass svg { height: 126px; }

  .nav-primary-metrics > div { padding: 6px 8px; }
  .nav-primary-metrics strong { font-size: 14px; }
  .nav-detail-section { padding: 10px 12px; }
  .map-vessel-panel .popup-weather { margin: 10px 12px 12px; }
}

@media (max-width: 390px) {
  .nav-vessel-overview { grid-template-columns: 118px minmax(0, 1fr); gap: 7px; }
  .map-vessel-panel .nav-vessel-overview .nav-compass,
  .map-vessel-panel .nav-vessel-overview .nav-compass svg { height: 118px; }
  .nav-machinery-grid { grid-template-columns: 1fr 1fr; gap: 5px; }
  .map-vessel-panel .nav-popup-grid { grid-template-columns: 88px minmax(0, 1fr); }
}

/* Fleet vessel comparison dock */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.map-vessel-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.vessel-compare-toolbar {
  flex: 0 0 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 5px 6px 5px 10px;
  border-bottom: 1px solid rgba(81, 150, 165, 0.34);
  background: rgba(4, 20, 29, 0.98);
  z-index: 20;
  cursor: move;
  touch-action: none;
}

.map-vessel-panel.is-dragging,
.map-vessel-panel.is-dragging .vessel-compare-toolbar {
  user-select: none;
  cursor: grabbing;
}

.vessel-compare-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.vessel-compare-title strong {
  color: #eaf9fb;
  font-size: 12px;
  line-height: 1;
}

.vessel-compare-title span {
  color: #6f9aa5;
  font: 800 8px/1 ui-monospace, monospace;
  text-transform: uppercase;
}

.vessel-compare-picker {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  cursor: default;
}

.vessel-compare-picker select {
  width: min(178px, 18vw);
  height: 30px;
  min-width: 112px;
  padding: 0 28px 0 9px;
  border: 1px solid rgba(93, 180, 198, 0.42);
  border-radius: 4px;
  background: #0a2a36;
  color: #eaf9fb;
  font-size: 10px;
  font-weight: 800;
}

.vessel-compare-picker button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(93, 180, 198, 0.42);
  border-radius: 4px;
  background: #0d3542;
  color: #cceef3;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.map-vessel-panel .map-vessel-close {
  position: static;
  float: none;
  margin: 0;
  background: #3b1721;
  color: #ff98aa;
}

.vessel-panel-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(var(--compare-count, 1), minmax(0, 1fr));
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

.vessel-compare-card {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border-top: 3px solid var(--ship-color, #13c7df);
  background: rgba(5, 24, 34, 0.98);
  scrollbar-color: rgba(128, 199, 213, 0.55) rgba(255, 255, 255, 0.04);
  scrollbar-width: thin;
}

.vessel-compare-card + .vessel-compare-card {
  border-left: 1px solid rgba(81, 150, 165, 0.38);
}

.vessel-compare-card.active {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ship-color, #13c7df) 64%, transparent);
}

.vessel-card-close {
  position: sticky;
  top: 8px;
  float: right;
  width: 30px;
  height: 30px;
  margin: 8px 8px -38px 0;
  padding: 0;
  border: 1px solid rgba(145, 189, 199, 0.32);
  border-radius: 4px;
  background: #102f3a;
  color: #effcff;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  z-index: 14;
}

.vessel-compare-card > .vessel-card-close {
  display: none;
}

.ais-panel-action {
  float: right;
  min-height: 24px;
  margin: -4px 0 0 8px;
  padding: 0 7px;
  border: 1px solid rgba(103, 221, 236, 0.46);
  border-radius: 4px;
  background: rgba(10, 54, 67, 0.9);
  color: #9cecf4;
  font: 900 8px/1 ui-monospace, monospace;
  text-transform: uppercase;
  cursor: pointer;
}

.ais-panel-action.matched {
  border-color: rgba(45, 212, 191, 0.62);
  background: rgba(6, 78, 59, 0.82);
  color: #8cf6d7;
}

.ais-panel-action:hover { filter: brightness(1.18); }

.ais-match-basis {
  margin: -2px 0 7px;
  color: #76a4ae;
  font: 800 8px/1.2 ui-monospace, monospace;
  text-transform: uppercase;
}

.vessel-card-close:hover {
  border-color: #ff6b82;
  background: #4b1b25;
}

.vessel-compare-card .nav-popup-card > header {
  padding-right: 48px;
}

.speed-indicator-value {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
}

.speed-indicator-value i {
  flex: 0 0 13px;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: var(--speed-light, #64748b);
  box-shadow: 0 0 0 2px rgba(1, 10, 16, 0.62), 0 0 12px var(--speed-light, #64748b);
}

.speed-indicator-value strong {
  margin-top: 0;
}

.map-vessel-panel.multi {
  top: auto;
  right: 14px;
  bottom: 58px;
  left: 202px;
  width: auto;
  max-width: none;
  height: min(64vh, 680px);
  max-height: calc(100dvh - 76px);
}

body.clean-map .map-vessel-panel.multi,
.shell.side-collapsed .map-vessel-panel.multi {
  left: 14px;
}

.map-vessel-panel.multi .vessel-compare-title {
  grid-auto-flow: column;
  align-items: baseline;
  gap: 8px;
}

.map-vessel-panel.multi .vessel-compare-picker select {
  width: min(240px, 26vw);
}

@media (max-width: 1100px) {
  .map-vessel-panel.multi { left: 14px; }
  .map-vessel-panel.triple .nav-vessel-overview { grid-template-columns: 118px minmax(0, 1fr); gap: 7px; }
  .map-vessel-panel.triple .nav-vessel-overview .nav-compass,
  .map-vessel-panel.triple .nav-vessel-overview .nav-compass svg { height: 118px; }
}

@media (max-width: 760px) {
  .map-vessel-panel,
  .map-vessel-panel.multi {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: min(80dvh, 720px);
    max-height: 80dvh;
    min-width: 0;
    min-height: 0;
    resize: none;
  }

  .map-vessel-panel::after { display: none; }

  .vessel-compare-toolbar {
    flex: 0 0 auto;
    min-height: 52px;
    padding-left: 9px;
    cursor: default;
    touch-action: auto;
  }

  .vessel-compare-title strong { font-size: 11px; }
  .vessel-compare-picker select { width: min(46vw, 190px); }

  .vessel-panel-grid {
    display: flex;
    gap: 7px;
    padding: 0 7px 7px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
  }

  .vessel-compare-card {
    flex: 0 0 calc(100vw - 14px);
    border: 1px solid rgba(81, 150, 165, 0.38);
    border-top: 3px solid var(--ship-color, #13c7df);
    scroll-snap-align: start;
  }
}

@media (max-width: 390px) {
  .vessel-compare-title span { display: none; }
  .vessel-compare-picker select { min-width: 104px; width: 43vw; }
  .vessel-compare-picker button { width: 30px; height: 30px; }
}

/* Independent compact vessel panels */
.map-vessel-panel,
.map-vessel-panel.multi,
.map-vessel-panel.triple {
  position: absolute;
  inset: 0;
  z-index: 760;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  overflow: visible;
  resize: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: none;
}

.map-vessel-panel::after { display: none; }

.map-vessel-panel > .vessel-compare-toolbar {
  position: absolute;
  top: 114px;
  right: 14px;
  width: min(312px, calc(100vw - 28px));
  min-height: 36px;
  padding: 4px 5px 4px 9px;
  border: 1px solid rgba(75, 185, 208, 0.58);
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
  pointer-events: auto;
  cursor: default;
  touch-action: auto;
}

.map-vessel-panel .vessel-compare-title strong { font-size: 10px; }
.map-vessel-panel .vessel-compare-title span { font-size: 7px; }
.map-vessel-panel .vessel-compare-picker select {
  width: min(175px, 18vw);
  height: 27px;
  font-size: 9px;
}
.map-vessel-panel .vessel-compare-picker > button {
  width: 27px;
  height: 27px;
  font-size: 17px;
}

.map-vessel-panel > .vessel-panel-grid {
  position: absolute;
  inset: 0;
  display: block;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  padding: 0;
  pointer-events: none;
}

.map-vessel-panel .vessel-compare-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 280px;
  min-height: 280px;
  max-width: calc(100vw - 20px);
  max-height: calc(100dvh - 20px);
  overflow: hidden;
  resize: both;
  border: 1px solid rgba(75, 185, 208, 0.58);
  border-top: 3px solid var(--ship-color, #13c7df);
  border-radius: 7px;
  background: rgba(5, 24, 34, 0.98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  pointer-events: auto;
}

.map-vessel-panel .vessel-compare-card::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 12px;
  height: 12px;
  border-right: 2px solid rgba(103, 221, 236, 0.9);
  border-bottom: 2px solid rgba(103, 221, 236, 0.9);
  pointer-events: none;
}

.vessel-compare-card.is-dragging {
  user-select: none;
  cursor: grabbing;
  opacity: 0.94;
}

.vessel-card-toolbar {
  flex: 0 0 28px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 3px 4px 3px 8px;
  border-bottom: 1px solid rgba(81, 150, 165, 0.34);
  background: #061b25;
  cursor: move;
  touch-action: none;
}

.vessel-card-toolbar > strong {
  color: var(--ship-color, #7ce7f1);
  font: 900 10px/1 ui-monospace, monospace;
}

.vessel-card-toolbar > span {
  overflow: hidden;
  color: #638b95;
  font: 800 7px/1 ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vessel-card-toolbar .vessel-card-close {
  position: static;
  display: grid;
  place-items: center;
  float: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border-radius: 4px;
  font-size: 15px;
}

.vessel-card-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: rgba(128, 199, 213, 0.55) rgba(255, 255, 255, 0.04);
  scrollbar-width: thin;
}

.vessel-card-scroll .nav-popup-card > header {
  min-height: 53px;
  padding: 7px 42px 7px 9px;
}
.vessel-card-scroll .nav-popup-card > header small { margin-bottom: 3px; font-size: 7px; }
.vessel-card-scroll .nav-popup-card > header strong { font-size: 15px; }
.vessel-card-scroll .nav-popup-card > header span { font-size: 8px; line-height: 1.2; }
.vessel-card-scroll .nav-vessel-overview {
  grid-template-columns: 98px minmax(0, 1fr);
  gap: 6px;
  padding: 6px 7px;
}
.vessel-card-scroll .nav-vessel-overview .nav-compass,
.vessel-card-scroll .nav-vessel-overview .nav-compass svg { height: 94px; }
.vessel-card-scroll .nav-primary-metrics { gap: 3px; }
.vessel-card-scroll .nav-primary-metrics > div { padding: 4px 5px; }
.vessel-card-scroll .nav-primary-metrics span,
.vessel-card-scroll .nav-machinery-grid span { font-size: 7px; }
.vessel-card-scroll .nav-primary-metrics strong { font-size: 12px; }
.vessel-card-scroll .nav-primary-metrics small { font-size: 7px; }
.vessel-card-scroll .nav-detail-section { padding: 6px 7px; }
.vessel-card-scroll .nav-detail-section h4 { margin-bottom: 5px; font-size: 8px; }
.vessel-card-scroll .nav-popup-grid {
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 3px 6px;
  font-size: 9px;
}
.vessel-card-scroll .nav-machinery-grid { gap: 4px; }
.vessel-card-scroll .nav-machinery-grid > div { padding: 5px; }
.vessel-card-scroll .nav-machinery-grid strong { font-size: 11px; }
.vessel-card-scroll .popup-weather { margin: 6px 7px 8px; }
.vessel-card-scroll .weather-head { padding: 7px; }
.vessel-card-scroll .weather-head strong { font-size: 11px; }
.vessel-card-scroll .weather-detail-grid { grid-template-columns: 58px minmax(0, 1fr); font-size: 9px; }

@media (max-width: 760px) {
  .map-vessel-panel,
  .map-vessel-panel.multi,
  .map-vessel-panel.triple {
    position: fixed;
    inset: 0;
  }

  .map-vessel-panel > .vessel-compare-toolbar {
    top: auto;
    right: 7px;
    bottom: min(72dvh, 612px);
    left: 7px;
    width: auto;
  }

  .map-vessel-panel .vessel-compare-picker select {
    width: min(52vw, 210px);
  }

  .map-vessel-panel > .vessel-panel-grid {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    height: min(72dvh, 575px);
    gap: 7px;
    padding: 0 7px 7px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    pointer-events: auto;
  }

  .map-vessel-panel .vessel-compare-card {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    flex: 0 0 calc(100vw - 14px);
    width: calc(100vw - 14px) !important;
    height: 100% !important;
    min-width: 0;
    min-height: 0;
    max-width: none;
    max-height: none;
    resize: none;
    scroll-snap-align: start;
  }

  .map-vessel-panel .vessel-compare-card::after { display: none; }
  .vessel-card-toolbar { cursor: default; touch-action: auto; }
}

/* Mobile map shell: keep the chart primary and move advanced tools into a sheet. */
.mobile-mapbar,
.mobile-controls-backdrop,
.mobile-controls-close {
  display: none;
}

@media (max-width: 760px) {
  html,
  body,
  .shell,
  .map-panel {
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    overflow: hidden;
  }

  .mobile-mapbar {
    position: fixed;
    top: max(8px, env(safe-area-inset-top));
    right: 8px;
    left: 8px;
    z-index: 1080;
    display: grid;
    grid-template-columns: minmax(112px, 1fr) repeat(3, minmax(54px, auto));
    align-items: center;
    gap: 5px;
    min-height: 54px;
    padding: 6px;
    border: 1px solid rgba(190, 213, 220, 0.9);
    border-radius: 13px;
    background: rgba(248, 251, 251, 0.94);
    box-shadow: 0 12px 30px rgba(7, 28, 42, 0.2);
    backdrop-filter: blur(16px);
  }

  .mobile-mapbar-brand {
    display: grid;
    grid-template-columns: 31px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: #17394c;
  }

  .mobile-mapbar-brand strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 31px;
    height: 29px;
    border-radius: 7px;
    color: #fff;
    background: #17394c;
    font-size: 11px;
    letter-spacing: 0.05em;
  }

  .mobile-mapbar-brand span {
    overflow: hidden;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.035em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .mobile-mapbar > button,
  .mobile-controls-close {
    min-width: 0;
    min-height: 42px;
    padding: 0 9px;
    border: 1px solid rgba(23, 57, 76, 0.18);
    border-radius: 9px;
    color: #17394c;
    background: rgba(225, 236, 239, 0.78);
    cursor: pointer;
    font: inherit;
    font-size: 10px;
    font-weight: 900;
    touch-action: manipulation;
  }

  .mobile-mapbar > .mobile-menu-btn {
    color: #fff;
    border-color: #0f766e;
    background: #0f766e;
  }

  .mobile-controls-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1090;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    opacity: 0;
    background: rgba(3, 16, 27, 0.48);
    backdrop-filter: blur(2px);
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.mobile-controls-open .mobile-controls-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .topbar.compact-bar,
  body.clean-map .topbar.compact-bar {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1100;
    display: flex;
    width: auto;
    max-width: none;
    max-height: min(72dvh, 620px);
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 10px;
    padding: 10px 10px max(12px, env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    border: 0;
    border-top: 1px solid rgba(125, 166, 178, 0.5);
    border-radius: 18px 18px 0 0;
    opacity: 0;
    background: rgba(246, 250, 250, 0.98);
    box-shadow: 0 -20px 48px rgba(5, 22, 34, 0.32);
    transform: translateY(104%);
    transition: transform 220ms ease, opacity 180ms ease;
    pointer-events: none;
  }

  body.mobile-controls-open .topbar.compact-bar {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  body.mobile-controls-open > button,
  body.mobile-controls-open .fleet-ticker {
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .topbar.compact-bar > .compact-brand {
    position: sticky;
    top: -10px;
    z-index: 2;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    width: 100%;
    min-height: 48px;
    padding: 8px 2px;
    background: rgba(246, 250, 250, 0.98);
  }

  .mobile-controls-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
  }

  .topbar.compact-bar > .track-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
  }

  .topbar.compact-bar > .replay-launch {
    width: 100%;
    min-height: 46px;
    padding: 7px 34px 7px 11px;
    border-radius: 9px;
  }

  .replay-launch strong { font-size: 12px; }
  .replay-launch small { font-size: 9px; }

  .topbar.compact-bar .track-presets {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .topbar.compact-bar .track-status {
    grid-column: 1 / -1;
    min-height: 28px;
    padding: 7px 9px;
    border-radius: 8px;
    text-align: center;
    background: rgba(220, 232, 235, 0.74);
  }

  .topbar.compact-bar .top-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
  }

  .topbar.compact-bar .track-btn,
  .topbar.compact-bar .icon-btn {
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 7px;
    border-radius: 9px;
    font-size: 11px;
    touch-action: manipulation;
  }

  .ais-legend,
  .speed-color-panel,
  .map-cursor-control {
    display: none !important;
  }

  .fleet-ticker {
    top: auto;
    right: 8px;
    bottom: calc(70px + env(safe-area-inset-bottom));
    left: 8px;
    z-index: 650;
    height: 38px;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 6px;
    padding: 5px 6px;
    border-radius: 10px;
  }

  .fleet-ticker-label {
    height: 26px;
    padding: 0 7px;
    font-size: 8px;
  }

  .ticker-item {
    gap: 5px;
    font-size: 10px;
  }

  .ticker-item strong {
    font-size: 10px;
  }

  .leaflet-top.leaflet-right {
    top: calc(70px + env(safe-area-inset-top));
    right: 8px;
  }

  .leaflet-bottom.leaflet-right {
    right: 8px;
    bottom: calc(116px + env(safe-area-inset-bottom));
  }

  .leaflet-popup.track-point-popup .leaflet-popup-content {
    max-height: calc(100dvh - 180px);
  }

  .track-point-detail-scroll {
    max-height: min(430px, calc(100dvh - 270px));
  }
}

@media (max-width: 360px) {
  .mobile-mapbar {
    grid-template-columns: minmax(94px, 1fr) repeat(3, minmax(48px, auto));
  }

  .mobile-mapbar-brand span {
    font-size: 9px;
  }

  .mobile-mapbar > button {
    padding: 0 6px;
    font-size: 9px;
  }

  .topbar.compact-bar .top-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-controls-backdrop,
  .topbar.compact-bar {
    transition: none;
  }
}

.speed-color-panel.hidden { display: none !important; }

#umayLauncher {
  width: 104px !important;
  height: 48px !important;
  font-size: 15px !important;
}

body.geofence-panel-open #umayLauncher,
body.geofence-panel-open #umayBackdrop,
body.geofence-panel-open #umayPanel {
  display: none !important;
}

body.clean-map .topbar.compact-bar,
body.clean-map .mobile-mapbar,
body.clean-map .mobile-controls-backdrop,
body.clean-map .speed-color-panel,
body.clean-map #aisLegend,
body.clean-map .fleet-ticker,
body.clean-map .map-cursor-control,
body.clean-map .ais-receiver-panel,
body.clean-map .ais-settings-panel,
body.clean-map .geofence-panel,
body.clean-map .ocean-risk-panel,
body.clean-map .measure-panel,
body.clean-map .range-ring-panel,
body.clean-map .zones-panel,
body.clean-map .map-vessel-panel,
body.clean-map .side-panel,
body.clean-map .leaflet-control-container,
body.clean-map #umayLauncher,
body.clean-map #umayBackdrop,
body.clean-map #umayPanel {
  display: none !important;
}

body.clean-map .show-controls-btn {
  display: inline-flex !important;
}
