:root {
  color-scheme: dark;
  --bg: #07111f;
  --surface: #0d1a2c;
  --surface-raised: #13233a;
  --surface-soft: #172a44;
  --border: #263d5c;
  --border-strong: #3d5b80;
  --text: #edf5ff;
  --muted: #9fb2ca;
  --muted-strong: #c3d1e3;
  --primary: #39a8ff;
  --primary-hover: #62baff;
  --accent: #39d5b0;
  --accent-hover: #65e2c4;
  --danger: #ff7f8c;
  --shadow: 0 18px 45px rgb(0 0 0 / 28%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
}

.map-page {
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.app-header {
  position: relative;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: rgb(8 18 32 / 96%);
  box-shadow: 0 5px 22px rgb(0 0 0 / 18%);
}

.app-header-unified {
  min-height: 64px;
}

.header-context {
  min-width: 0;
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.app-nav {
  position: absolute;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgb(10 23 39 / 78%);
  transform: translateX(-50%);
}

.app-nav a {
  white-space: nowrap;
  flex-shrink: 0;
  padding: 7px 12px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  text-decoration: none;
}

.app-nav a:hover {
  color: var(--text);
}

.app-nav a.is-active {
  color: #061522;
  background: var(--primary);
}

.brand,
.account,
.account form {
  display: flex;
  align-items: center;
}

.brand {
  min-width: 0;
  gap: 11px;
}

.brand-mark,
.login-brand-mark {
  display: grid;
  place-items: center;
  color: #06131d;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  font-weight: 900;
  box-shadow: 0 0 28px rgb(57 168 255 / 22%);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: 19px;
}

.brand div {
  display: grid;
  min-width: 0;
  line-height: 1.1;
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0.01em;
}

.brand span:not(.brand-mark) {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account {
  gap: 12px;
}

.account-name {
  max-width: 220px;
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  min-height: 0;
}

.map-page-minimal .map-account-header {
  justify-content: flex-end;
}

.map-page-minimal .map-account-header .account-name {
  display: block;
}

.map-page-minimal .workspace {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.map-page-minimal .control-panel,
.map-page-minimal .map-notice,
.map-page-minimal .destination-route-panel,
.map-page-minimal .marked-vessels-dock {
  display: none !important;
}

.control-panel {
  position: relative;
  z-index: 1000;
  min-height: 0;
  padding: 14px 15px 22px;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  background:
    radial-gradient(circle at 90% 0%, rgb(57 168 255 / 9%), transparent 230px),
    var(--surface);
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.panel-heading h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.state-badge {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--muted);
  background: rgb(13 26 44 / 80%);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.state-badge[data-active="true"] {
  border-color: rgb(57 213 176 / 55%);
  color: var(--accent);
  background: rgb(57 213 176 / 9%);
}

.control-section {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.control-section h2,
.snapshot-card h2,
.traffic-card h2 {
  margin: 0 0 9px;
  font-size: 13px;
  font-weight: 750;
}

.polygon-help p,
.field-hint,
.login-subtitle {
  color: var(--muted);
  line-height: 1.5;
}

.polygon-help p {
  margin: -2px 0 13px;
  font-size: 12px;
}

.field-grid,
.animation-settings {
  display: grid;
  gap: 8px;
}

.field-grid {
  grid-template-columns: 1fr 1fr;
}

.animation-settings {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
}

.field-animation-zone {
  grid-column: 1 / -1;
}

.field-track-retention {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 650;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  height: 35px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  outline: 0;
  color: var(--text);
  background: #091625;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.field select option {
  color: #07111f;
  background: #f7fbff;
}

.field select {
  color-scheme: light;
}

.field input:hover,
.field select:hover {
  border-color: #53759e;
}

.field input:focus,
.field select:focus,
.button:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(57 168 255 / 18%);
}

.field input[type="datetime-local"] {
  color-scheme: dark;
  font-size: 12px;
}

.compound-input,
.input-suffix {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 35px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #091625;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.compound-input:focus-within,
.input-suffix:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(57 168 255 / 18%);
}

.compound-input input,
.compound-input select,
.input-suffix input {
  height: 33px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none !important;
}

.compound-input input {
  width: 42%;
}

.compound-input select {
  width: 58%;
  padding-left: 7px;
  border-left: 1px solid var(--border);
}

.input-suffix input {
  flex: 1 1 auto;
  min-width: 0;
}

.input-suffix > span {
  padding-right: 10px;
  color: var(--muted);
  font-weight: 500;
}

.field-hint {
  margin: 9px 0 0;
  font-size: 10px;
}

.button {
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  outline: 0;
  font-size: 12px;
  font-weight: 750;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, opacity 140ms ease, transform 100ms ease;
}

.button:not(:disabled):active {
  transform: translateY(1px);
}

.button:disabled {
  opacity: 0.43;
}

.button-full {
  width: 100%;
}

.button-primary {
  color: #061522;
  background: var(--primary);
}

.button-primary:not(:disabled):hover {
  background: var(--primary-hover);
}

.button-accent {
  color: #061813;
  background: var(--accent);
}

.button-accent:not(:disabled):hover {
  background: var(--accent-hover);
}

.button-secondary,
.button-quiet {
  border-color: var(--border-strong);
  color: var(--muted-strong);
  background: var(--surface-raised);
}

.button-secondary:not(:disabled):hover,
.button-quiet:not(:disabled):hover {
  border-color: #56779f;
  color: var(--text);
  background: var(--surface-soft);
}

.button-quiet {
  min-height: 32px;
  padding: 6px 11px;
  background: transparent;
}

.header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.action-section {
  display: grid;
  gap: 8px;
}

.playback-buttons {
  display: grid;
  grid-template-columns: 1.25fr 1fr 0.85fr;
  gap: 7px;
}

.playback-buttons .button {
  padding-inline: 8px;
}

.snapshot-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgb(19 35 58 / 72%);
}

.switch-field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin-top: 10px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.switch-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch {
  position: relative;
  width: 32px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #091625;
  transition: border-color 140ms ease, background 140ms ease;
}

.switch::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
  transition: transform 140ms ease, background 140ms ease;
}

.switch-field input:checked + .switch {
  border-color: var(--accent);
  background: rgb(57 213 176 / 18%);
}

.switch-field input:checked + .switch::after {
  background: var(--accent);
  transform: translateX(14px);
}

.switch-field input:focus-visible + .switch {
  outline: 3px solid rgb(57 168 255 / 18%);
  outline-offset: 2px;
}

.filter-section {
  color: var(--muted-strong);
}

.filter-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  list-style: none;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.filter-section > summary::-webkit-details-marker {
  display: none;
}

.filter-section > summary::after {
  color: var(--muted);
  content: "▾";
  transition: transform 140ms ease;
}

.filter-section:not([open]) > summary::after {
  transform: rotate(-90deg);
}

.filter-section > summary > span:first-child {
  flex: 1 1 auto;
}

.filter-count {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding-inline: 5px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--accent);
  font-size: 10px;
}

.filter-group {
  display: grid;
  gap: 7px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.filter-group h3 {
  margin: 0 0 2px;
  color: var(--primary);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.string-filter {
  display: grid;
  grid-template-columns: 94px 74px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
}

.string-filter label,
.range-filter > span,
.datetime-filter > span {
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.string-filter input,
.string-filter select,
.range-filter input,
.datetime-filter input {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 7px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  outline: 0;
  color: var(--text);
  background: #091625;
  font-size: 10px;
}

.string-filter input:focus,
.string-filter select:focus,
.range-filter input:focus,
.datetime-filter input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgb(57 168 255 / 16%);
}

.range-filter,
.datetime-filter {
  display: grid;
  grid-template-columns: minmax(94px, 1fr) 86px 86px;
  gap: 5px;
  align-items: center;
}

.datetime-filter {
  grid-template-columns: 78px minmax(0, 1fr) minmax(0, 1fr);
}

.datetime-filter input {
  padding-inline: 4px;
  color-scheme: dark;
  font-size: 9px;
}

.filter-section > .button {
  margin-top: 10px;
}

.traffic-card {
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgb(19 35 58 / 72%);
}

.traffic-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.traffic-heading h2 {
  margin: 0;
}

#traffic-current {
  color: var(--accent);
  font-size: 13px;
}

.traffic-chart-wrap {
  position: relative;
  margin-top: 8px;
}

#traffic-chart {
  display: block;
  width: 100%;
  height: 92px;
  border-radius: 5px;
  outline: 0;
}

#traffic-chart:focus-visible {
  box-shadow: 0 0 0 3px rgb(57 168 255 / 22%);
}

.traffic-chart-tooltip {
  position: absolute;
  z-index: 2;
  bottom: calc(100% + 7px);
  left: 0;
  max-width: min(260px, 100%);
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: #07111f;
  background: #f7fbff;
  box-shadow: 0 7px 20px rgb(0 0 0 / 30%);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.35;
  white-space: nowrap;
  pointer-events: none;
  transform: translateX(-50%);
}

.snapshot-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.snapshot-card-heading h2 {
  margin: 0;
}

#result-count {
  color: var(--accent);
  font-size: 13px;
}

.snapshot-card dl {
  display: grid;
  gap: 8px;
  margin: 13px 0 0;
}

.snapshot-card dl div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.snapshot-card dt {
  color: var(--muted);
  font-size: 10px;
}

.snapshot-card dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 11px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-status {
  min-height: 18px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.panel-status[data-kind="success"] {
  color: var(--accent);
}

.panel-status[data-kind="error"] {
  color: var(--danger);
}

.panel-status[data-kind="warning"] {
  color: #ffd37a;
}

.map-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: #0a1724;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 280px;
  background: #102136;
}

.map-notice {
  position: absolute;
  z-index: 800;
  top: 18px;
  left: 50%;
  display: grid;
  width: min(440px, calc(100% - 130px));
  padding: 12px 15px;
  border: 1px solid rgb(74 108 147 / 70%);
  border-radius: 10px;
  color: var(--text);
  background: rgb(9 22 37 / 91%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  transform: translateX(-50%);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
  pointer-events: none;
}

.map-notice strong {
  font-size: 12px;
}

.map-notice span {
  margin-top: 4px;
  color: var(--muted-strong);
  font-size: 11px;
  line-height: 1.4;
}

.map-notice.is-hidden {
  visibility: hidden;
  opacity: 0;
  transform: translate(-50%, -8px);
}

.map-notice[data-kind="error"] {
  border-color: rgb(255 127 140 / 65%);
}

.destination-route-panel {
  position: absolute;
  z-index: 850;
  top: 88px;
  right: 12px;
  display: grid;
  width: min(350px, calc(100% - 24px));
  max-height: calc(100% - 112px);
  gap: 10px;
  padding: 13px;
  border: 1px solid rgb(80 207 226 / 64%);
  border-radius: 10px;
  color: var(--text);
  background:
    linear-gradient(145deg, rgb(21 55 76 / 94%), rgb(8 25 42 / 96%)),
    var(--surface);
  box-shadow: 0 16px 38px rgb(0 0 0 / 34%);
  backdrop-filter: blur(9px);
  overflow-y: auto;
  overscroll-behavior: contain;
  pointer-events: auto;
}

.destination-route-panel[hidden],
.vessel-history-panel[hidden],
.destination-route-summary[hidden],
.destination-route-disclaimer[hidden] {
  display: none !important;
}

.vessel-history-panel {
  border-color: rgb(139 92 246 / 72%);
  background:
    linear-gradient(145deg, rgb(56 35 99 / 95%), rgb(17 18 43 / 97%)),
    var(--surface);
}

.vessel-history-panel .destination-route-eyebrow {
  color: #c4b5fd;
}

.analysis-voyage-port-marker {
  display: grid;
  border: 2px solid #ede9fe;
  border-radius: 50%;
  color: #fff;
  background: #7c3aed;
  box-shadow: 0 2px 8px rgb(0 0 0 / 45%);
  font-size: 11px;
  font-weight: 800;
  place-items: center;
}

.analysis-voyage-ports h3 { margin: 3px 0 10px; color: #e5dcff; font-size: 12px; }
.analysis-voyage-timeline { display: grid; gap: 11px; margin: 0; padding-left: 22px; color: #c4b5fd; font-size: 11px; }
.analysis-voyage-timeline li { padding-left: 3px; }
.analysis-voyage-timeline time,
.analysis-voyage-timeline small { display: block; margin-top: 4px; color: var(--muted-strong); font-size: 10px; }
.analysis-voyage-timeline li > span:not(.analysis-voyage-port-button) { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.analysis-voyage-port-button { max-width: 100%; padding: 0; border: 0; color: #ede9fe; background: transparent; font: inherit; font-weight: 700; line-height: 1.5; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.analysis-voyage-port-button:not(button) { cursor: default; }
button.analysis-voyage-port-button:hover,
button.analysis-voyage-port-button:focus-visible { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.analysis-voyage-port-button:disabled { color: var(--muted-strong); cursor: default; text-decoration: none; }

.vessel-history-panel .destination-route-clear {
  border-color: rgb(139 92 246 / 72%);
  color: #f1edff;
  background: rgb(109 40 217 / 34%);
}

.vessel-history-panel .destination-route-close:hover,
.vessel-history-panel .destination-route-close:focus-visible,
.vessel-history-panel .destination-route-clear:hover,
.vessel-history-panel .destination-route-clear:focus-visible {
  border-color: #a78bfa;
  background: rgb(109 40 217 / 55%);
  box-shadow: 0 0 0 3px rgb(139 92 246 / 18%);
}

.destination-route-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.destination-route-heading h2 {
  margin: 2px 0 0;
  font-size: 14px;
  line-height: 1.25;
}

.destination-route-eyebrow {
  color: #67dff0;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.destination-route-close {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: var(--muted-strong);
  background: rgb(7 18 31 / 78%);
  font-size: 17px;
  cursor: pointer;
  place-items: center;
}

.destination-route-status {
  display: flex;
  align-items: center;
  min-height: 18px;
  gap: 7px;
  margin: 0;
  color: var(--muted-strong);
  font-size: 11px;
  line-height: 1.4;
}

.destination-route-status[data-kind="loading"]::before {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border: 2px solid rgb(103 223 240 / 28%);
  border-top-color: #67dff0;
  border-radius: 50%;
  content: "";
  animation: destination-route-spin 0.8s linear infinite;
}

.destination-route-status[data-kind="error"] {
  color: #ff9ba5;
}

.destination-route-status[data-kind="success"] {
  color: #69e0bd;
}

.destination-route-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 0;
}

.destination-route-summary > div {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgb(55 91 119 / 74%);
  border-radius: 7px;
  background: rgb(6 20 34 / 54%);
}

.destination-route-summary > div:first-child {
  grid-column: 1 / -1;
}

.destination-route-summary dt {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.destination-route-summary dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.3;
}

.destination-route-disclaimer {
  margin: 0;
  padding: 8px 9px;
  border-left: 2px solid rgb(255 209 102 / 72%);
  border-radius: 0 6px 6px 0;
  color: #c7d4df;
  background: rgb(255 209 102 / 7%);
  font-size: 9px;
  line-height: 1.45;
}

.destination-route-clear {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid rgb(80 207 226 / 62%);
  border-radius: 7px;
  color: #dffbff;
  background: rgb(30 115 133 / 34%);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.destination-route-close:hover,
.destination-route-close:focus-visible,
.destination-route-clear:hover,
.destination-route-clear:focus-visible {
  border-color: #67dff0;
  outline: 0;
  background: rgb(31 137 157 / 54%);
  box-shadow: 0 0 0 3px rgb(80 207 226 / 16%);
}

@keyframes destination-route-spin {
  to { transform: rotate(360deg); }
}

.map-legend {
  position: absolute;
  z-index: 700;
  top: 12px;
  right: 12px;
  bottom: auto;
  padding: 7px 10px;
  border: 1px solid rgb(55 82 113 / 74%);
  border-radius: 7px;
  color: var(--muted-strong);
  background: rgb(9 22 37 / 84%);
  font-size: 10px;
  box-shadow: 0 8px 20px rgb(0 0 0 / 20%);
  pointer-events: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px 9px;
  max-width: min(270px, calc(100% - 24px));
}

.map-legend span + span,
.map-legend-toggle + span {
  margin-left: 0;
}

.map-legend-toggle {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
}

.map-legend-toggle[aria-pressed="false"] {
  opacity: 0.48;
  text-decoration: line-through;
}

.legend-port {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 3px;
  border: 1px solid #334155;
  border-radius: 50%;
  background: conic-gradient(#14b8a6, #d99a38, #38bdf8, #f472b6, #14b8a6);
}

.legend-maritime-vector {
  display: inline-block;
  width: 15px;
  height: 7px;
  margin-right: 3px;
  vertical-align: 1px;
  background: linear-gradient(
    150deg,
    transparent 39%,
    #38bdf8 40% 56%,
    transparent 57%
  );
  clip-path: polygon(0 32%, 72% 32%, 72% 0, 100% 50%, 72% 100%, 72% 68%, 0 68%);
}

.legend-territorial-waters {
  display: inline-block;
  width: 12px;
  height: 8px;
  margin-right: 3px;
  border: 1px solid rgb(37 75 149 / 92%);
  border-radius: 2px;
  background:
    linear-gradient(135deg, transparent 42%, rgb(37 75 149 / 92%) 44% 56%, transparent 58%),
    rgb(58 166 176 / 28%);
}

.leaflet-territorial-waters-pane,
.leaflet-territorial-waters-pane .leaflet-layer,
.leaflet-territorial-waters-pane img {
  pointer-events: none !important;
}

.territorial-waters-popup .leaflet-popup-content {
  margin: 14px 16px;
  color: #18324d;
}

.territorial-waters-info h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.territorial-waters-info h4 {
  margin: 0 0 6px;
  color: #0f5f91;
  font-size: 13px;
}

.territorial-waters-info p {
  margin: 0 0 8px;
  line-height: 1.4;
}

.territorial-waters-info-zone {
  padding: 8px 0;
  border-top: 1px solid #d8e4ef;
  line-height: 1.42;
}

.territorial-waters-info-zone span {
  color: #5c7085;
}

.territorial-waters-info small {
  display: block;
  margin-top: 8px;
  color: #6a7d90;
}

.territorial-waters-info-neutral h3 {
  color: #35516d;
}

.territorial-waters-info-loading,
.territorial-waters-info-error {
  padding: 4px 0;
  color: #35516d;
}

.territorial-waters-info-error {
  color: #a22d39;
}

.visually-hidden {
  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;
}

.marked-vessels-dock {
  position: absolute;
  z-index: 750;
  bottom: 25px;
  left: 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: min(900px, calc(100% - 24px));
  height: min(34vh, 310px);
  max-height: calc(100% - 50px);
  pointer-events: none;
}

.marked-vessels-dock.all-panels-collapsed {
  height: auto;
}

.marked-vessels,
.marked-events {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgb(55 82 113 / 88%);
  border-radius: 9px;
  color: var(--text);
  background: rgb(9 22 37 / 94%);
  box-shadow: 0 12px 32px rgb(0 0 0 / 34%);
  backdrop-filter: blur(9px);
  pointer-events: auto;
}

.marked-vessels {
  flex: 1.08 1 0;
}

.marked-events {
  flex: 0.92 1 0;
}

.marked-vessels.is-collapsed,
.marked-events.is-collapsed {
  flex: 0 1 auto;
  height: auto;
  max-width: 100%;
}

.marked-panel-content {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.marked-panel-content[hidden] {
  display: none !important;
}

.marked-vessels-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px 8px;
  border-bottom: 1px solid rgb(55 82 113 / 64%);
}

.marked-vessels-heading h2 {
  min-width: 0;
  margin: 0;
  font-size: 12px;
  line-height: 1.2;
}

.is-collapsed .marked-vessels-heading {
  border-bottom-color: transparent;
}

.marked-panel-heading-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.marked-panel-toggle {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  padding: 0;
  border: 1px solid rgb(61 91 128 / 90%);
  border-radius: 6px;
  color: var(--muted-strong);
  background: rgb(19 35 58 / 82%);
  font-size: 16px;
  font-weight: 750;
  line-height: 1;
}

.marked-events-filter-open {
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid rgb(57 168 255 / 70%);
  border-radius: 6px;
  color: #bde2ff;
  background: rgb(57 168 255 / 10%);
  font-size: 8px;
  font-weight: 750;
}

.marked-events-filter-open:hover,
.marked-events-filter-open:focus-visible {
  color: #06131d;
  background: var(--primary);
}

.marked-panel-toggle:hover {
  border-color: var(--primary);
  color: var(--text);
  background: rgb(57 168 255 / 16%);
}

.marked-vessels-count {
  display: inline-grid;
  min-width: 22px;
  min-height: 20px;
  place-items: center;
  padding-inline: 6px;
  border-radius: 999px;
  color: #06131d;
  background: var(--accent);
  font-size: 10px;
  font-weight: 850;
}

.marked-vessels-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 41px;
  margin: 0;
  padding: 9px 11px;
  color: var(--muted-strong);
  font-size: 10px;
  line-height: 1.4;
}

.marked-vessels-status[data-kind="error"] {
  color: #ffc1c7;
}

.marked-vessels-retry,
.marked-vessel-unmark,
.marked-vessel-locate {
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 750;
}

.marked-vessels-retry,
.marked-vessel-unmark {
  border: 1px solid rgb(255 127 140 / 70%);
  color: #ffc1c7;
  background: rgb(255 127 140 / 9%);
}

.marked-vessel-locate {
  border: 1px solid rgb(57 168 255 / 70%);
  color: #bde2ff;
  background: rgb(57 168 255 / 10%);
}

.marked-vessels-retry:hover:not(:disabled),
.marked-vessel-unmark:hover:not(:disabled) {
  color: #fff;
  background: #9d4151;
}

.marked-vessel-locate:hover:not(:disabled),
.marked-vessel-locate[aria-pressed="true"] {
  color: #06131d;
  background: var(--primary);
}

.marked-vessels-retry:focus-visible,
.marked-vessel-unmark:focus-visible,
.marked-vessel-locate:focus-visible,
.marked-vessel-expand:focus-visible,
.marked-panel-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.marked-vessel-unmark:disabled,
.marked-vessel-locate:disabled {
  opacity: 0.62;
}

.marked-vessels-table-wrap,
.marked-events-table-wrap {
  min-height: 0;
  overflow: auto;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

.marked-vessels-table-wrap:focus-visible,
.marked-events-table-wrap:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.marked-vessels-table,
.marked-events-table,
.marked-vessel-properties {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.marked-vessels-table > thead,
.marked-events-table > thead {
  position: sticky;
  z-index: 1;
  top: 0;
  color: var(--muted);
  background: #0c1c30;
}

.marked-vessels-table th,
.marked-vessels-table td,
.marked-events-table th,
.marked-events-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgb(55 82 113 / 46%);
  font-size: 9px;
  text-align: left;
  vertical-align: middle;
}

.marked-vessels-table > thead th,
.marked-events-table > thead th {
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.marked-vessels-table > thead th:first-child {
  width: 37%;
}

.marked-vessels-table > thead th:nth-child(2) {
  width: 25%;
}

.marked-vessels-table > thead th:last-child {
  width: 38%;
}

.marked-vessel-expand {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 2px 0;
  overflow: hidden;
  border: 0;
  color: var(--text);
  background: transparent;
  font-size: 10px;
  font-weight: 750;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marked-vessel-expand::before {
  display: inline-block;
  width: 12px;
  color: var(--primary);
  content: "▸";
}

.marked-vessel-expand[aria-expanded="true"]::before {
  content: "▾";
}

.marked-vessel-identifiers {
  overflow: hidden;
  color: var(--muted-strong);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marked-vessel-action {
  text-align: right !important;
}

.marked-vessel-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.marked-vessel-details[hidden],
.marked-vessels-table-wrap[hidden],
.marked-events-table-wrap[hidden],
.marked-vessels-status[hidden] {
  display: none !important;
}

.marked-vessel-details > td {
  padding: 0 8px 8px;
  background: rgb(19 35 58 / 72%);
}

.marked-vessel-properties th,
.marked-vessel-properties td {
  padding: 5px 7px;
  overflow-wrap: anywhere;
  border-bottom: 1px solid rgb(55 82 113 / 35%);
  font-size: 9px;
  line-height: 1.35;
  vertical-align: top;
}

.marked-vessel-properties th[scope="row"] {
  width: 42%;
  color: var(--muted);
  font-weight: 600;
}

.marked-vessel-properties td {
  color: var(--muted-strong);
}

.marked-vessel-property-section th {
  padding-top: 8px;
  color: var(--primary);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.marked-vessel-properties-empty {
  color: var(--muted) !important;
  text-align: center;
}

.marked-events-table > thead th:first-child {
  width: 29%;
}

.marked-events-table > thead th:nth-child(2) {
  width: 49%;
}

.marked-events-table > thead th:last-child {
  width: 22%;
}

.marked-events-table td {
  vertical-align: top;
}

.marked-events-table td:last-child {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
}

.marked-event-vessel,
.marked-event-title,
.marked-event-vessel + small,
.marked-event-values {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.marked-event-vessel,
.marked-event-title {
  color: var(--text);
  font-size: 9px;
  line-height: 1.3;
}

.marked-event-vessel + small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.marked-event-values {
  margin-top: 3px;
  color: var(--muted-strong);
  font-size: 8px;
  line-height: 1.35;
}

.marked-event-values b {
  margin-inline: 4px;
  color: var(--accent);
}

.infinite-scroll-sentinel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 30px;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.3;
  text-align: center;
}

.infinite-scroll-sentinel[data-kind="loading"] {
  color: var(--primary);
}

.infinite-scroll-sentinel[data-kind="error"] {
  color: var(--danger);
}

.infinite-scroll-sentinel:empty {
  display: none;
}

.monitored-track-tooltip {
  display: grid;
  gap: 2px;
  color: #112037;
  font-size: 10px;
  line-height: 1.3;
}

.legend-vessel {
  display: inline-block;
  width: 9px;
  height: 11px;
  margin-right: 5px;
  vertical-align: -1px;
  background: var(--primary);
  clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%);
}

.legend-vessel-reviewed { background: #20bf6b; }
.legend-vessel-monitored { background: #ef4056; }
.legend-vessel-unreviewed { background: #278cff; }
.legend-vessel-port-latest { background: #a855f7; }

.legend-track {
  display: inline-block;
  width: 13px;
  height: 2px;
  margin-right: 5px;
  vertical-align: 3px;
  background: var(--primary);
}

.leaflet-container {
  font-family: inherit;
}

.leaflet-bar a,
.leaflet-draw-toolbar a {
  background-color: #f7fbff;
}

.measurement-toolbar {
  display: grid;
  overflow: hidden;
  border: 0 !important;
  border-radius: 4px;
  box-shadow: 0 1px 5px rgb(0 0 0 / 65%);
}

.measurement-toolbar button {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  border-bottom: 1px solid #ccc;
  color: #1f3348;
  background: #f7fbff;
  cursor: pointer;
}

.measurement-toolbar button:last-child {
  border-bottom: 0;
}

.measurement-toolbar button:hover:not(:disabled),
.measurement-toolbar button:focus-visible,
.measurement-toolbar .measurement-toggle.is-active,
.measurement-toolbar .trajectory-ruler-toggle.is-active {
  color: #fff;
  background: #8d55d9;
}

.measurement-toolbar button:focus-visible {
  outline: 2px solid #39a8ff;
  outline-offset: -2px;
}

.measurement-toolbar button:disabled {
  opacity: 0.42;
  cursor: default;
}

.measurement-clear span {
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
}

.measurement-ruler-icon {
  position: relative;
  display: block;
  width: 20px;
  height: 7px;
  border: 2px solid currentcolor;
  border-radius: 2px;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 3px,
    currentcolor 3px 4px,
    transparent 4px 7px
  );
  transform: rotate(-38deg);
}

.trajectory-ruler-icon {
  display: block;
  font-size: 17px;
  line-height: 1;
}

.leaflet-container.measurement-active,
.leaflet-container.measurement-active canvas,
.leaflet-container.trajectory-ruler-active,
.leaflet-container.trajectory-ruler-active canvas {
  cursor: crosshair !important;
}

.leaflet-measurement-lines-pane,
.leaflet-measurement-labels-pane {
  pointer-events: none !important;
}

.measurement-label-marker {
  overflow: visible !important;
  border: 0;
  background: transparent;
  pointer-events: none !important;
}

.measurement-label-marker > span {
  position: absolute;
  left: 0;
  bottom: 8px;
  width: max-content;
  max-width: 240px;
  padding: 3px 6px;
  border: 1px solid rgb(255 255 255 / 65%);
  border-radius: 5px;
  color: #fff;
  background: rgb(21 31 45 / 90%);
  box-shadow: 0 2px 7px rgb(0 0 0 / 35%);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.25;
  white-space: nowrap;
  transform: translateX(-50%);
}

.measurement-label-marker > .measurement-total-label {
  bottom: 12px;
  border-color: #ffbe78;
  color: #3b2208;
  background: #ffd39e;
}

.measurement-label-marker > .measurement-live-label {
  border-color: #b993ef;
  background: rgb(83 48 128 / 94%);
}

.measurement-label-marker > .trajectory-ruler-live-label {
  border-color: #70e4d8;
  background: rgb(0 92 88 / 94%);
}

.trajectory-ruler-label-marker {
  overflow: visible !important;
  border: 0;
  background: transparent;
  pointer-events: none !important;
}

.trajectory-ruler-point-label {
  position: absolute;
  left: 0;
  bottom: 10px;
  display: grid;
  width: max-content;
  max-width: 280px;
  gap: 2px;
  padding: 5px 7px;
  border: 1px solid rgb(112 228 216 / 80%);
  border-radius: 6px;
  color: #eafffc;
  background: rgb(0 63 68 / 92%);
  box-shadow: 0 2px 8px rgb(0 0 0 / 40%);
  font-size: 9px;
  line-height: 1.25;
  white-space: normal;
  transform: translateX(-50%);
}

.trajectory-ruler-point-label strong {
  color: #8af3e8;
  font-size: 10px;
}

.trajectory-ruler-point-popup {
  display: grid;
  min-width: 255px;
  gap: 3px;
}

.trajectory-ruler-point-popup strong {
  margin-bottom: 2px;
  color: #087d75;
  font-size: 13px;
}

.trajectory-ruler-point-popup span {
  display: block;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  color: #112037;
  background: #f7fbff;
}

.leaflet-popup-content {
  min-width: 190px;
  margin: 12px 15px;
  font-size: 12px;
  line-height: 1.55;
}

.vessel-popup-title,
.port-popup-title {
  display: block;
  margin-bottom: 4px;
  color: #0b4d77;
  font-size: 13px;
}

.vessel-popup-label,
.port-popup-label {
  color: #52657b;
}

.vessel-destination-port-button {
  display: inline;
  max-width: 100%;
  padding: 0;
  border: 0;
  color: #076aa7;
  background: transparent;
  font: inherit;
  font-weight: 750;
  text-align: left;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.vessel-destination-port-button:hover:not(:disabled),
.vessel-destination-port-button:focus-visible {
  color: #064e7a;
  text-decoration-style: solid;
}

.vessel-destination-port-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.vessel-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.vessel-flag-icon {
  display: inline-block;
  width: 24px;
  height: 18px;
  flex: 0 0 24px;
  border: 1px solid rgba(17, 32, 55, 0.2);
  border-radius: 2px;
  object-fit: cover;
  vertical-align: middle;
  box-shadow: 0 1px 2px rgba(17, 32, 55, 0.15);
}

.vessel-flag-fallback {
  width: 24px;
  flex: 0 0 24px;
  color: #52657b;
  font-size: 1rem;
  line-height: 1;
  text-align: center;
}

.vessel-properties-button,
.vessel-route-button,
.vessel-destination-route-button,
.vessel-snapshot-button,
.vessel-properties-back,
.vessel-properties-export,
.vessel-property-name,
.vessel-property-change-count {
  border: 1px solid #5782a6;
  border-radius: 6px;
  color: #123d5d;
  background: #e8f4fc;
  font: inherit;
  cursor: pointer;
}

.vessel-properties-button {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin-top: 9px;
  padding: 6px 9px;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
}

.vessel-route-button {
  width: 100%;
  margin-top: 6px;
  padding: 6px 9px;
  border-color: #6d28d9;
  color: #fff;
  background: #7c3aed;
  font-weight: 750;
}

.vessel-destination-route-button {
  width: 100%;
  margin-top: 6px;
  padding: 7px 9px;
  border-color: #1b8192;
  color: #0d5360;
  background: #dffaff;
  font-weight: 800;
}

.vessel-snapshot-button {
  width: 100%;
  margin-top: 9px;
  padding: 7px 9px;
  border-color: #176b9e;
  color: #fff;
  background: #176b9e;
  font-weight: 800;
}

.vessel-properties-button:hover:not(:disabled),
.vessel-route-button:hover:not(:disabled),
.vessel-destination-route-button:hover:not(:disabled),
.vessel-snapshot-button:hover:not(:disabled),
.vessel-properties-back:hover:not(:disabled),
.vessel-properties-export:hover:not(:disabled),
.vessel-property-name:hover:not(:disabled),
.vessel-property-change-count:hover:not(:disabled),
.vessel-property-name[aria-expanded="true"],
.vessel-property-change-count[aria-expanded="true"] {
  color: #fff;
  background: #176b9e;
}

.vessel-route-button:hover:not(:disabled) {
  border-color: #5b21b6;
  background: #6d28d9;
}

.vessel-destination-route-button:hover:not(:disabled) {
  border-color: #126879;
  background: #126879;
}

.vessel-destination-route-button:disabled {
  opacity: 0.68;
  cursor: wait;
}

.destination-route-mile-popup {
  display: grid;
  min-width: 175px;
  gap: 4px;
}

.destination-route-mile-popup strong {
  color: #0d6170;
  font-size: 13px;
}

.destination-route-mile-popup span {
  color: #52657b;
}

.vessel-snapshot-button:hover:not(:disabled) {
  border-color: #0b4d77;
  background: #0b4d77;
}

.vessel-snapshot-button:disabled {
  opacity: 0.68;
  cursor: wait;
}

.vessel-properties-panel {
  width: min(700px, 78vw);
  color: #1b3046;
}

.vessel-properties-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #0b4d77;
  font-size: 14px;
}

.vessel-properties-back {
  flex: 0 0 auto;
  padding: 4px 9px;
  font-size: 10px;
  font-weight: 750;
}

.vessel-properties-heading-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.vessel-properties-export {
  padding: 4px 9px;
  border: 1px solid #178750;
  border-radius: 6px;
  color: #12653e;
  background: #eafff3;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.vessel-properties-export:hover:not(:disabled) {
  color: #fff;
  background: #168a50;
}

.vessel-properties-export:disabled {
  opacity: 0.62;
  cursor: wait;
}

.vessel-properties-meta {
  margin: 5px 0 8px;
  color: #64768a;
  font-size: 10px;
}

.vessel-properties-table-wrap {
  max-height: min(58vh, 520px);
  overflow: auto;
  border: 1px solid #c5d4df;
  border-radius: 7px;
}

.vessel-properties-table,
.vessel-property-history table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.vessel-properties-table th,
.vessel-properties-table td,
.vessel-property-history th,
.vessel-property-history td {
  padding: 5px 7px;
  overflow-wrap: anywhere;
  border-bottom: 1px solid #dbe5ec;
  font-size: 10px;
  text-align: left;
  vertical-align: top;
}

.vessel-properties-table > thead {
  position: sticky;
  z-index: 2;
  top: 0;
  color: #fff;
  background: #244b69;
}

.vessel-properties-table > thead th:first-child { width: 34%; }
.vessel-properties-table > thead th:nth-child(2) { width: 52%; }
.vessel-properties-table > thead th:last-child { width: 14%; text-align: center; }

.vessel-property-section th {
  color: #145d89;
  background: #eaf3f8;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.vessel-property-name {
  width: 100%;
  padding: 3px 5px;
  text-align: left;
}

.vessel-property-current {
  color: #344c62;
}

.vessel-property-change-count {
  display: block;
  min-width: 34px;
  margin: 0 auto;
  padding: 3px 6px;
  font-weight: 800;
  text-align: center;
}

.vessel-property-history-row[hidden] {
  display: none;
}

.vessel-property-history-row > td {
  padding: 8px;
  background: #f1f6f9;
}

.vessel-property-history-row > td[data-kind="error"] {
  color: #a5293a;
}

.vessel-property-history {
  max-height: 240px;
  overflow: auto;
}

.vessel-property-history th:first-child { width: 27%; }
.vessel-property-history th:nth-child(2),
.vessel-property-history th:nth-child(3) { width: 36.5%; }

.vessel-property-history-note,
.vessel-properties-empty {
  margin: 0;
  padding: 7px;
  color: #64768a;
  font-size: 10px;
}

.port-details-button {
  width: 100%;
  margin-top: 9px;
  padding: 6px 9px;
  border: 1px solid #a87918;
  border-radius: 7px;
  color: #5d4008;
  background: #fff1bf;
  font-weight: 750;
}

.port-popup-actions {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}

.port-popup-actions .port-details-button,
.port-popup-actions .port-inbound-button,
.port-popup-actions .port-match-button {
  width: 100%;
  margin: 0;
}

.port-detail {
  box-sizing: border-box;
  width: min(900px, calc(100vw - 96px));
  min-width: 0;
  overflow: hidden;
}

.port-detail h3 {
  margin: 10px 0 5px;
  color: #263e58;
  font-size: 12px;
}

.port-alias-section {
  margin: 7px 0;
}

.port-summary-aliases {
  margin: 7px 0;
  color: #354b61;
  font-size: 10px;
}

.port-summary-aliases summary {
  cursor: pointer;
  font-weight: 750;
}

.port-summary-aliases[open] summary {
  margin-bottom: 5px;
}

.port-alias-list {
  display: flex;
  max-height: 112px;
  flex-wrap: wrap;
  gap: 5px;
  overflow: auto;
  padding: 1px 2px 3px 0;
}

.port-alias-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid #cad7e3;
  border-radius: 999px;
  color: #354b61;
  background: #f4f8fb;
  font-size: 10px;
  line-height: 1.25;
}

.port-presence-note {
  margin: 5px 0;
  color: #6a7786;
  font-size: 10px;
}

.port-export-button {
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid #0877af;
  border-radius: 7px;
  color: #fff;
  background: #0877af;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.port-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-block: 7px;
}

.port-inbound-button {
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid #6f42c1;
  border-radius: 7px;
  color: #fff;
  background: #6f42c1;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.port-inbound-button:hover,
.port-inbound-button:focus-visible {
  background: #56319a;
}

.port-match-button {
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid #b02a58;
  border-radius: 7px;
  color: #fff;
  background: #c93468;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.port-match-button:hover,
.port-match-button:focus-visible { background: #9e244f; }

.port-match-selection {
  position: absolute;
  z-index: 1120;
  left: 50%;
  top: 18px;
  display: flex;
  box-sizing: border-box;
  width: min(720px, calc(100% - 36px));
  padding: 13px 15px;
  transform: translateX(-50%);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #8da8bd;
  border-radius: 11px;
  background: #fffffff2;
  box-shadow: 0 12px 34px #15344b38;
}

.port-match-selection[hidden] { display: none; }
.port-match-selection div:first-child { display: grid; gap: 2px; min-width: 0; }
.port-match-selection span { color: #8a1538; font-weight: 800; }
.port-match-selection small { overflow: hidden; color: #566f83; text-overflow: ellipsis; white-space: nowrap; }
.port-match-selection-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.port-match-card { width: min(620px, calc(100vw - 34px)); }

.task-notification-stack {
  position: fixed;
  z-index: 5000;
  right: 18px;
  top: 72px;
  display: grid;
  gap: 9px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.task-notification {
  display: grid;
  gap: 3px;
  padding: 13px 15px;
  border: 1px solid #85b69e;
  border-radius: 10px;
  color: #143e2b;
  background: #e7fff1;
  box-shadow: 0 10px 30px #102b3c38;
  text-decoration: none;
  pointer-events: auto;
}

.task-notification-failed { border-color: #d9919c; color: #6f1927; background: #fff0f2; }
.task-nav-indicator { color: #ef4056; font-size: 9px; }

@media (max-width: 700px) {
  .port-match-selection { top: 8px; align-items: stretch; flex-direction: column; }
  .port-match-selection-actions { justify-content: flex-end; }
}

.port-export-button:hover,
.port-export-button:focus-visible {
  background: #075f8c;
}

.port-vessel-list {
  display: grid;
  gap: 4px;
  width: 100%;
  min-width: 0;
  max-height: 210px;
  overflow: auto;
}

.port-event-list {
  display: grid;
  gap: 3px;
  width: 100%;
  min-width: 0;
  max-height: 180px;
  overflow: auto;
}

.port-event-list p {
  margin: 0;
  padding: 4px 6px;
  border-radius: 4px;
  color: #344c62;
  background: #eef4f8;
  font-size: 10px;
}

.port-vessel-item {
  padding: 5px 7px;
  border: 1px solid #d4dde6;
  border-radius: 5px;
  color: #15334d;
  background: #fff;
  text-align: left;
}

.port-data-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  color: #253d54;
  background: #fff;
  font-size: 9px;
}

.port-data-table th,
.port-data-table td {
  padding: 4px 6px;
  border: 1px solid #dce4eb;
  text-align: left;
  white-space: nowrap;
}

.port-data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #405b74;
  background: #edf3f7;
}

.port-vessel-row {
  cursor: pointer;
}

.port-vessel-row:hover,
.port-vessel-row:focus {
  outline: 1px solid #0b78b5;
  background: #e8f5fc;
}

.port-vessel-row[aria-busy="true"] {
  opacity: 0.62;
  cursor: wait;
}

.vessel-popup-location-note {
  display: block;
  margin: 5px 0;
  padding: 5px 7px;
  border-radius: 5px;
  color: #5d238c;
  background: #f3e8ff;
  font-size: 10px;
  font-weight: 750;
}

.vessel-popup-history-note {
  display: block;
  margin: 5px 0;
  padding: 5px 7px;
  border-radius: 5px;
  color: #654506;
  background: #fff1bf;
  font-size: 10px;
  font-weight: 750;
}

.port-properties-wrap {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-height: 230px;
  overflow: auto;
  border: 1px solid #d4dde6;
  border-radius: 5px;
}

.port-properties {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

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

.port-properties th {
  width: 42%;
  color: #52657b;
  font-weight: 700;
}

.port-export-card {
  grid-template-rows: auto auto auto auto;
  width: min(520px, 100%);
}

.port-export-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 18px 17px 8px;
}

.port-export-fields .field {
  display: grid;
  gap: 6px;
}

.port-export-fields input {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: #111;
  background: #fff;
}

.port-export-status {
  min-height: 18px;
  margin: 0;
  padding: 6px 17px 14px;
  color: var(--muted-strong);
  font-size: 11px;
}

.port-export-status[data-kind="error"] { color: #ff8794; }
.port-export-status[data-kind="success"] { color: #63dfa4; }
.port-export-status[data-kind="loading"] { color: var(--primary); }

.vessel-route-card {
  grid-template-rows: auto auto auto auto;
  width: min(560px, 100%);
}

.trajectory-ruler-card {
  grid-template-rows: auto auto auto auto;
  width: min(590px, 100%);
}

.trajectory-ruler-fields {
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.4fr);
}

.trajectory-ruler-fields input:invalid:not(:placeholder-shown) {
  border-color: #ef4056;
}

.vessel-route-datetime-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 7px;
  min-width: 0;
}

.vessel-route-datetime-control input {
  width: 100%;
  min-width: 0;
}

.vessel-route-picker-button {
  display: grid;
  width: 38px;
  min-height: 35px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: #d7e8f7;
  background: #091625;
  font-size: 17px;
  cursor: pointer;
}

.vessel-route-picker-button:hover,
.vessel-route-picker-button:focus-visible {
  border-color: var(--primary);
  background: #12304b;
  box-shadow: 0 0 0 3px rgb(57 168 255 / 18%);
}

.vessel-route-picker-button:disabled {
  opacity: 0.72;
  cursor: wait;
}

.port-inbound-drawer {
  position: fixed;
  z-index: 5000;
  top: 72px;
  left: 14px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  box-sizing: border-box;
  width: min(820px, calc(100vw - 28px));
  height: min(72vh, 720px);
  min-width: min(420px, calc(100vw - 16px));
  min-height: 260px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow: hidden;
  resize: both;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  background: rgb(7 22 37 / 96%);
  box-shadow: 0 18px 46px rgb(0 0 0 / 42%);
  pointer-events: auto;
}

.port-inbound-drawer[hidden] {
  display: none;
}

.port-inbound-drawer[data-collapsed="true"] {
  grid-template-rows: auto;
  min-height: 0;
  resize: none;
}

.port-inbound-drawer[data-collapsed="true"] .port-inbound-status,
.port-inbound-drawer[data-collapsed="true"] .port-inbound-toolbar,
.port-inbound-drawer[data-collapsed="true"] .port-inbound-table-wrap {
  display: none;
}

.port-inbound-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  background: #0d2135;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.port-inbound-drawer[data-dragging="true"] .port-inbound-drawer-header {
  cursor: grabbing;
}

.port-inbound-drawer-header > div:first-child {
  min-width: 0;
}

.port-inbound-drawer-header h2,
.port-inbound-drawer-header p {
  margin: 0;
}

.port-inbound-drawer-header h2 {
  font-size: 14px;
}

.port-inbound-drawer-header p {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted-strong);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.port-inbound-drawer-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  cursor: default;
}

.port-inbound-drawer-control {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 1px solid #416684;
  border-radius: 7px;
  color: #e9f5ff;
  background: #14304a;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.port-inbound-drawer-control:hover,
.port-inbound-drawer-control:focus-visible {
  border-color: var(--primary);
  background: #1b5076;
}

.port-inbound-status {
  min-height: 18px;
  margin: 0;
  padding: 10px 17px;
  color: var(--muted-strong);
  font-size: 11px;
}

.port-inbound-status[data-kind="error"] { color: #ff8794; }
.port-inbound-status[data-kind="success"] { color: #63dfa4; }
.port-inbound-status[data-kind="loading"] { color: var(--primary); }

.port-inbound-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  padding: 10px 13px 4px;
  border-bottom: 1px solid rgb(65 102 132 / 45%);
  background: #091a2a;
}

.port-inbound-toolbar label {
  display: grid;
  gap: 3px;
  color: var(--muted-strong);
  font-size: 10px;
}

.port-inbound-toolbar input {
  min-width: 138px;
  min-height: 32px;
  box-sizing: border-box;
  padding: 5px 8px;
  border: 1px solid #416684;
  border-radius: 7px;
  color: #e9f5ff;
  color-scheme: dark;
  background: #10283e;
  font: inherit;
}

.port-inbound-export-button {
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid #0877af;
  border-radius: 7px;
  color: #fff;
  background: #0877af;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.port-inbound-export-button:hover:not(:disabled),
.port-inbound-export-button:focus-visible:not(:disabled) {
  background: #075f8c;
}

.port-inbound-export-button:disabled,
.port-inbound-toolbar input:disabled {
  opacity: 0.65;
  cursor: wait;
}

.port-inbound-table-wrap {
  min-width: 0;
  min-height: 120px;
  padding: 0 13px 13px;
  overflow: auto;
}

.port-inbound-table {
  font-size: 10px;
}

.port-inbound-vessel-row {
  cursor: pointer;
}

.port-inbound-vessel-row:hover,
.port-inbound-vessel-row:focus {
  outline: 1px solid #9e74e8;
  background: #f2ebff;
}

.port-inbound-empty {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted-strong);
  text-align: center;
}

.vessel-route-fields input:disabled {
  opacity: 0.72;
  cursor: wait;
}

@media (max-width: 620px) {
  .port-detail { width: calc(100vw - 54px); }
  .port-export-fields { grid-template-columns: 1fr; }
  .port-inbound-drawer {
    top: 8px;
    left: 8px;
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
    min-width: 0;
  }
  .port-inbound-drawer[data-collapsed="true"] {
    width: calc(100vw - 16px);
  }
  .port-inbound-toolbar { align-items: stretch; }
  .port-inbound-toolbar label { flex: 1 1 130px; }
  .port-inbound-toolbar input { width: 100%; }
  .port-inbound-export-button { flex: 1 1 100%; }
}

.vessel-popup-link {
  color: #076aa7;
  font-weight: 750;
}

.vessel-monitor-actions {
  display: grid;
  gap: 6px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid #d9e3ed;
}

.vessel-monitor-button {
  width: 100%;
  min-height: 31px;
  padding: 5px 10px;
  border: 1px solid #0b78b5;
  border-radius: 7px;
  color: #fff;
  background: #0879b7;
  font-size: 11px;
  font-weight: 750;
}

.vessel-monitor-button:hover:not(:disabled) {
  border-color: #075f91;
  background: #075f91;
}

.vessel-monitor-button[aria-pressed="true"] {
  border-color: #a24d5b;
  color: #7b2635;
  background: #fff1f3;
}

.vessel-monitor-button[aria-pressed="true"]:hover:not(:disabled) {
  border-color: #7b2635;
  color: #fff;
  background: #9d4151;
}

.vessel-monitor-button:focus-visible {
  outline: 3px solid rgb(8 121 183 / 24%);
  outline-offset: 2px;
}

.vessel-monitor-button:disabled {
  opacity: 0.62;
}

.vessel-reviewed-button {
  width: 100%;
  min-height: 31px;
  padding: 5px 10px;
  border: 1px solid #178750;
  border-radius: 7px;
  color: #12653e;
  background: #eafff3;
  font-size: 11px;
  font-weight: 750;
}

.vessel-reviewed-button:hover:not(:disabled),
.vessel-reviewed-button[aria-pressed="true"] {
  color: #fff;
  background: #168a50;
}

.event-filter-modal {
  position: fixed;
  z-index: 2000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.event-filter-modal[hidden] { display: none !important; }

.event-filter-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(2 9 17 / 78%);
  backdrop-filter: blur(4px);
}

.event-filter-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(780px, 100%);
  max-height: min(760px, calc(100dvh - 40px));
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  color: var(--text);
  background: #0b1b2e;
  box-shadow: 0 25px 70px rgb(0 0 0 / 55%);
}

.event-filter-header,
.event-filter-footer,
.event-filter-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 17px;
  border-bottom: 1px solid var(--border);
}

.event-filter-header { justify-content: space-between; }
.event-filter-header h2 { margin: 0; font-size: 17px; }
.event-filter-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.event-filter-close { border: 0; color: var(--text); background: transparent; font-size: 25px; }
.event-filter-toolbar { padding-block: 9px; }
.event-filter-toolbar button { border: 0; color: var(--primary); background: transparent; font-size: 11px; }
.event-filter-sections { display: grid; grid-template-columns: 1fr 1.25fr; gap: 14px; min-height: 0; padding: 14px 17px; overflow: auto; }
.event-filter-sections fieldset { min-width: 0; margin: 0; padding: 10px; border: 1px solid var(--border); border-radius: 9px; }
.event-filter-sections legend { padding-inline: 5px; color: var(--muted-strong); font-size: 11px; font-weight: 750; }
.event-filter-options { display: grid; gap: 5px; }
.event-filter-option { display: flex; align-items: flex-start; gap: 8px; padding: 6px; border-radius: 6px; color: var(--text); font-size: 11px; }
.event-filter-option:hover { background: rgb(57 168 255 / 9%); }
.event-filter-option input { margin-top: 2px; accent-color: var(--primary); }
.event-filter-option span, .event-filter-option small { display: block; min-width: 0; overflow-wrap: anywhere; }
.event-filter-option small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.event-filter-footer { justify-content: flex-end; border-top: 1px solid var(--border); border-bottom: 0; }
.modal-open { overflow: hidden; }

@media (max-width: 680px) {
  .event-filter-sections { grid-template-columns: 1fr; }
  .event-filter-card { max-height: calc(100dvh - 20px); }
}

.vessel-marker-icon {
  border: 0;
  background: transparent;
}

.vessel-triangle {
  display: block;
  width: 14px;
  height: 20px;
  margin: 2px 3px;
  background: var(--vessel-color, var(--accent));
  clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%);
  filter: drop-shadow(0 0 1px #fff) drop-shadow(0 2px 2px rgb(0 0 0 / 55%));
  transform: rotate(var(--vessel-angle, 0deg));
  transform-origin: 50% 50%;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 14% 18%, rgb(57 168 255 / 18%), transparent 31rem),
    radial-gradient(circle at 86% 82%, rgb(57 213 176 / 11%), transparent 28rem),
    linear-gradient(145deg, #07111f, #0a1829 55%, #07111f);
}

.login-layout {
  width: min(420px, calc(100% - 32px));
  margin: auto;
  padding: 32px 0;
}

.login-card {
  display: grid;
  gap: 24px;
  padding: clamp(27px, 4vw, 42px);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgb(13 26 44 / 90%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

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

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

.login-form .field {
  font-size: 13px;
}

.login-form .field input {
  height: 45px;
  padding-inline: 13px;
}

.login-submit {
  min-height: 45px;
  margin-top: 5px;
  font-size: 14px;
}

.form-error {
  padding: 11px 13px;
  border: 1px solid rgb(255 127 140 / 50%);
  border-radius: 8px;
  color: #ffc1c7;
  background: rgb(255 127 140 / 8%);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 340px;
  }

  .control-panel {
    padding-inline: 15px;
  }

  .animation-settings {
    grid-template-columns: 1fr;
  }

  .marked-vessels-dock {
    height: min(36vh, 290px);
  }

  .map-notice {
    top: 96px;
  }

}

@media (max-width: 760px) {
  .app-header-unified {
    padding-inline: 11px;
  }

  .app-header-unified .brand div,
  .app-header-unified .account-name,
  .app-header-unified .header-context {
    display: none;
  }

  .app-header-unified .app-nav {
    position: static;
    margin-left: auto;
    transform: none;
  }

  .app-header-unified .app-nav a {
    padding-inline: 9px;
  }
}

@media (max-width: 680px) {
  .map-page {
    grid-template-rows: 56px minmax(0, 1fr);
  }

  .app-header {
    padding-inline: 12px;
  }

  .app-header-unified {
    min-height: 56px;
  }

  .app-nav {
    position: static;
    margin-left: auto;
    transform: none;
  }

  .app-nav a {
    padding-inline: 9px;
    font-size: 10px;
  }

  .brand span:not(.brand-mark),
  .account-name {
    display: none;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(280px, 54vh) minmax(315px, 1fr);
  }

  .control-panel {
    padding: 16px 15px 20px;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .panel-heading {
    padding-bottom: 14px;
  }

  .control-section {
    padding-block: 14px;
  }

  .field-grid,
  .animation-settings {
    grid-template-columns: 1fr 1fr;
  }

  .string-filter {
    grid-template-columns: 90px 72px minmax(0, 1fr);
  }

  .map-notice {
    top: 12px;
    width: calc(100% - 118px);
  }

  .destination-route-panel {
    top: 74px;
    right: 8px;
    width: min(340px, calc(100% - 16px));
    max-height: calc(54vh - 84px);
    overflow-y: auto;
  }

  .marked-vessels-dock {
    right: 12px;
    width: auto;
    height: min(42vh, 270px);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    pointer-events: auto;
    scroll-snap-type: x proximity;
    scrollbar-color: var(--border-strong) transparent;
    scrollbar-width: thin;
  }

  .marked-vessels,
  .marked-events {
    flex: 0 0 min(82vw, 360px);
    scroll-snap-align: start;
  }

  .login-card {
    padding: 27px 22px;
  }
}

@media (max-width: 430px) {
  .field-grid,
  .animation-settings {
    grid-template-columns: 1fr;
  }

  .playback-buttons {
    grid-template-columns: 1.25fr 1fr 0.8fr;
  }

  .playback-buttons .button {
    font-size: 11px;
  }

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

  .destination-route-summary > div:first-child {
    grid-column: auto;
  }
}

/* A task journey keeps the narrow map visible above its full port history. */
@media (max-width: 680px) {
  .map-page:has(.vessel-history-panel[data-analysis-voyage="true"]:not([hidden])) {
    height: auto;
    min-height: 100dvh;
    grid-template-rows: 56px auto;
    overflow: auto;
  }

  .workspace:has(.vessel-history-panel[data-analysis-voyage="true"]:not([hidden])) {
    grid-template-rows: auto auto;
    align-content: start;
  }

  .map-shell:not(:has(.map-search)):has(.vessel-history-panel[data-analysis-voyage="true"]:not([hidden])) {
    display: grid;
    grid-template-rows: minmax(300px, 54vh) auto;
  }

  .map-shell:not(:has(.map-search)):has(.vessel-history-panel[data-analysis-voyage="true"]:not([hidden])) #map {
    height: max(300px, 54vh);
    grid-row: 1;
  }

  .vessel-history-panel[data-analysis-voyage="true"] {
    position: relative;
    inset: auto;
    grid-row: 2;
    width: auto;
    max-height: none;
    margin: 12px;
    overflow: visible;
  }
}

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

  .destination-route-status[data-kind="loading"]::before {
    animation: none;
  }
}

/* Long navigation labels remain accessible on narrow screens. */
@media (max-width: 1200px) {
  .app-header-unified { gap: 8px; }
  .app-header-unified .header-context { display: none; }
  .app-header-unified .app-nav {
    position: static;
    transform: none;
    margin-left: 0;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .app-header-unified .account { flex-shrink: 0; margin-left: auto; }
}

/* Search the already loaded map before consulting saved vessel positions. */
.map-search { position: absolute; z-index: 950; top: 12px; left: 50%; width: min(520px, calc(100% - 120px)); color: var(--text); transform: translateX(-50%); }
.map-search-bar { display: flex; align-items: center; min-width: 0; gap: 7px; min-height: 48px; padding: 5px 7px; border: 1px solid #426082; border-radius: 11px; background: rgb(9 23 39 / 97%); box-shadow: 0 8px 25px rgb(0 0 0 / 28%); }
.map-search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(57 168 255 / 16%), 0 8px 25px rgb(0 0 0 / 28%); }
.map-search-modes { display: flex; flex: 0 0 auto; gap: 2px; padding: 3px; border-radius: 7px; background: #142a43; }
.map-search-modes button { padding: 6px 8px; border: 0; border-radius: 5px; color: var(--muted-strong); background: transparent; font: inherit; font-size: 11px; font-weight: 750; cursor: pointer; }
.map-search-modes button[aria-pressed="true"] { color: #051425; background: var(--primary); }
.map-search input { flex: 1; width: 0; min-width: 0; height: 34px; padding: 0 2px; border: 0; outline: 0; color: var(--text); background: transparent; font: inherit; font-size: 12px; }
.map-search input::placeholder { color: var(--muted); }
.map-search input::-webkit-search-cancel-button { display: none; }
.map-search-clear { flex: 0 0 28px; height: 28px; padding: 0; border: 0; border-radius: 5px; color: var(--muted-strong); background: #20354e; font-size: 20px; cursor: pointer; }
.map-search-panel { margin-top: 6px; padding: 5px; border: 1px solid #426082; border-radius: 10px; background: rgb(9 23 39 / 98%); box-shadow: 0 14px 30px rgb(0 0 0 / 32%); }
.map-search [hidden] { display: none !important; }
#map-search-status { margin: 0; padding: 8px 9px; color: var(--muted-strong); font-size: 11px; line-height: 1.5; }
#map-search-status[data-kind="error"] { color: #ffc1c7; }
#map-search-status[data-kind="loading"] { color: #a6d7ff; }
#map-search-results { max-height: min(48vh, 365px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.map-search-result { display: grid; width: 100%; gap: 4px; padding: 10px; border: 0; border-top: 1px solid var(--border); border-radius: 5px; color: var(--text); background: transparent; text-align: left; font: inherit; cursor: pointer; }
.map-search-result strong { font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.map-search-result span { color: var(--muted-strong); font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.map-search-result small { color: #c4b5fd; font-size: 10px; line-height: 1.4; }
.map-search-result:hover,
.map-search-result[aria-selected="true"] { background: #203f60; }
.map-search-retry { margin: 4px 9px 8px; padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: 6px; color: var(--text); background: #20354e; font: inherit; font-size: 11px; cursor: pointer; }
.map-shell:has(.map-search) .map-notice { top: 76px; }
.map-shell:has(.map-search) .map-legend { top: auto; right: auto; bottom: 12px; left: 58px; justify-content: flex-start; }

@media (max-width: 680px) {
  .map-page:has(.map-search) { height: auto; min-height: 100dvh; grid-template-rows: 56px auto; overflow: auto; }
  .workspace:has(.map-search) { grid-template-rows: auto auto; align-content: start; }
  .map-shell:has(.map-search) { display: grid; grid-template-rows: auto minmax(300px, 54vh); align-content: start; }
  .map-shell:has(.map-search) #map { height: max(300px, 54vh); grid-row: 2; }
  .map-search { position: relative; top: auto; left: auto; grid-row: 1; width: calc(100% - 16px); margin: 8px; transform: none; }
  .map-search-bar { gap: 5px; }
  .map-search input { font-size: 16px; }
  .map-search-modes button { padding-inline: 7px; }
  #map-search-results { max-height: min(40vh, 310px); }
  .map-shell:has(.map-search) .map-notice { top: calc(var(--map-search-height, 64px) + 80px); }
  .map-shell:has(.map-search) .map-legend { top: calc(var(--map-search-height, 64px) + 12px); right: 10px; bottom: auto; left: auto; }
  .map-shell:has(.map-search) .destination-route-panel { position: relative; inset: auto; grid-row: auto; width: auto; max-height: none; margin: 12px; overflow: visible; }
  .map-page-minimal:has(.map-search) .workspace { grid-template-rows: auto; }
}
.port-type-filters > summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.port-type-filters fieldset { border: 0; padding: 0; margin: 10px 0; min-width: 0; }
.port-type-filters legend { font-size: 12px; color: #94a3b8; padding: 0; margin-bottom: 6px; }
.port-type-filters [hidden] { display: none !important; }
.port-type-option { display: flex; align-items: center; gap: 8px; padding: 7px 0; cursor: pointer; font-size: 12px; }
.port-type-option input { width: 16px; height: 16px; flex: 0 0 auto; accent-color: #39a8ff; }
.port-type-swatch { display: inline-block; width: 12px; height: 12px; border: 1px solid #ffffff88; border-radius: 50%; flex: 0 0 auto; }
.port-type-count { margin-left: auto; color: #94a3b8; font-variant-numeric: tabular-nums; }
.port-type-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.port-type-actions .button { flex: 1; padding: 7px 10px; }
.port-type-badges { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 5px 0 9px; }
.port-type-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; }
