.center-map-layout {
    display: block;
    width: 100%;
    min-width: 0;
}

.center-map-wrapper {
    position: relative;
    width: 100%;
    min-width: 0;
}

.center-route-map-container {
    width: 100% !important;
    max-width: 100%;
    height: 420px;
    min-height: 420px;
}

.center-route-map-container--globe-light {
    background: #64748b;
}

.center-route-map-container--globe-dark {
    background: #0f172a;
}

.center-map-canvas-shell {
    position: relative;
    width: 100%;
    min-width: 0;
}

.center-map-basemap-loading {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(15 23 42 / 0.82);
    color: rgb(226 232 240);
    pointer-events: none;
}

.center-map-basemap-loading__panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.center-map-basemap-loading__spinner {
    width: 1.75rem;
    height: 1.75rem;
    animation: center-map-spin 0.8s linear infinite;
}

@keyframes center-map-spin {
    to {
        transform: rotate(360deg);
    }
}

.center-map-wrapper:fullscreen,
.center-map-wrapper:-webkit-full-screen {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    background: var(--fi-body-bg, #fff);
}

.center-map-wrapper:fullscreen .center-map-canvas-shell,
.center-map-wrapper:-webkit-full-screen .center-map-canvas-shell {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.center-map-wrapper:fullscreen .center-route-map-container,
.center-map-wrapper:-webkit-full-screen .center-route-map-container {
    flex: 1 1 auto;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
}

.center-map-wrapper:fullscreen .leaflet-container,
.center-map-wrapper:-webkit-full-screen .leaflet-container {
    width: 100% !important;
    height: 100% !important;
}

.center-map-overlay-toolbar {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    right: 0.5rem;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    pointer-events: none;
}

.center-map-overlay-controls--time {
    flex: 1;
    min-width: 0;
    max-width: min(420px, calc(100% - 18rem));
    pointer-events: auto;
}

.center-map-overlay-controls--actions {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-left: auto;
    pointer-events: auto;
}

.center-map-time-control {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
    margin-left: 40px;
}

.center-map-datetime-input {
    width: 100%;
    max-width: 16rem;
    border-radius: 0.375rem;
    border: 1px solid rgb(209 213 219);
    background-color: rgb(255 255 255);
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: rgb(17 24 39);
}

.center-map-time-control__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}

.center-map-animation-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.center-map-animation-btn {
    flex-shrink: 0;
}

.center-map-preload-status {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 12rem;
}

.center-map-preload-progress {
    height: 0.375rem;
    width: 100%;
    overflow: hidden;
    border-radius: 9999px;
    background-color: rgb(229 231 235);
}

.dark .center-map-preload-progress {
    background-color: rgb(55 65 81);
}

.center-map-preload-progress__bar {
    height: 100%;
    border-radius: 9999px;
    background-color: rgb(37 99 235);
    transition: width 150ms ease-out;
}

.dark .center-map-preload-progress__bar {
    background-color: rgb(96 165 250);
}

.center-map-zoom-disabled {
    pointer-events: none;
    opacity: 0.45;
}

.center-map-time-stepper {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
}

.center-map-time-stepper input[type="range"] {
    flex: 1;
    min-width: 0;
    width: auto;
}

.center-map-time-step-btn {
    flex-shrink: 0;
}

.center-map-overlay-controls {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    pointer-events: auto;
}

.center-map-layer-control, .center-map-region-control {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.center-map-layer-label, .center-map-region-label {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    background: rgb(255 255 255 / 0.9);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
    color: rgb(55 65 81);
}

.dark .center-map-layer-label, .dark .center-map-region-label {
    background: rgb(31 41 55 / 0.9);
    color: rgb(229 231 235);
}

.center-map-layer-label .weather-layer-label-text,
.center-map-region-label .weather-region-label-text {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.center-map-overlay-status {
    position: absolute;
    top: 3.75rem;
    right: 0.5rem;
    left: auto;
    max-width: calc(100% - 1rem);
    z-index: 1000;
    pointer-events: none;
}

.center-map-overlay-status p {
    margin: 0;
    padding: 0.25rem 0.375rem;
    border-radius: 0.25rem;
    background: rgb(255 255 255 / 0.9);
}

.dark .center-map-overlay-status p {
    background: rgb(31 41 55 / 0.9);
}

.center-map-voyage-card {
    margin: 0;
    padding: 0.5rem 0.625rem;
    border-radius: 0.375rem;
    background: rgb(255 255 255 / 0.92);
    max-width: min(320px, calc(100% - 1rem));
    overflow-wrap: anywhere;
    word-break: break-word;
    pointer-events: auto;
}

.dark .center-map-voyage-card {
    background: rgb(31 41 55 / 0.92);
}

.center-map-voyage-card__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.center-map-voyage-card__title {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.25;
    width: 3rem;
}

.center-map-voyage-card__body {
    margin-top: 0.375rem;
}

.center-map-voyage-card__line {
    margin: 0 0 0.25rem;
    font-size: 0.75rem;
    line-height: 1.35;
    color: rgb(55 65 81);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.dark .center-map-voyage-card__line {
    color: rgb(229 231 235);
}

.center-map-voyage-card__line:last-child {
    margin-bottom: 0;
}

.center-map-bottom-left {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    max-width: min(320px, calc(100% - 1rem));
    pointer-events: none;
}

.center-map-fullscreen-btn {
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .center-map-layer-control .weather-layer-select, .center-map-region-control .weather-layer-select {
        max-width: calc(100vw - 4rem);
    }
}

.center-route-marker {
    background: transparent;
    border: 0;
}

.center-route-marker__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.center-route-marker--departure .center-route-marker__dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #16a34a;
    box-shadow: 0 1px 4px rgb(0 0 0 / 25%);
}

.center-route-marker--departure svg {
    width: 14px;
    height: 14px;
    color: #16a34a;
}

.center-route-marker--anchorage .center-route-marker__dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #d97706;
    box-shadow: 0 1px 4px rgb(0 0 0 / 25%);
}

.center-route-marker--anchorage svg {
    width: 14px;
    height: 14px;
    color: #d97706;
}

.center-route-marker--arrival .center-route-marker__dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #2563eb;
    box-shadow: 0 1px 4px rgb(0 0 0 / 25%);
}

.center-route-marker--arrival svg {
    width: 14px;
    height: 14px;
    color: #2563eb;
}

.center-route-marker--last .center-route-marker__arrow-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2563eb;
    box-shadow: 0 1px 4px rgb(0 0 0 / 25%);
}

.center-route-marker--last .center-route-marker__arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.center-route-marker--last svg {
    width: 16px;
    height: 16px;
    color: #fff;
}

.center-map-legend {
    position: relative;
    max-width: 100%;
    padding: 0.5rem 0.625rem;
    border-radius: 0.375rem;
    background: rgb(255 255 255 / 0.92);
    pointer-events: none;
    font-size: 0.75rem;
    box-shadow: 0 1px 3px rgb(0 0 0 / 12%);
}

.dark .center-map-legend {
    background: rgb(31 41 55 / 0.92);
}

.center-map-legend__title {
    margin: 0 0 0.375rem;
    font-weight: 600;
    line-height: 1.25;
}

.center-map-legend__row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.125rem;
}

.center-map-legend__row:last-child {
    margin-bottom: 0;
}

.center-map-legend__swatch {
    width: 1rem;
    height: 0.75rem;
    border-radius: 2px;
    flex-shrink: 0;
}

.center-map-legend__image {
    max-width: 100%;
    height: auto;
    display: block;
}

.center-map-legend__gradient {
    display: flex;
    align-items: stretch;
    gap: 0.375rem;
    min-height: 7.5rem;
}

.center-map-legend__gradient-bar {
    width: 0.875rem;
    border-radius: 2px;
    border: 1px solid rgb(0 0 0 / 12%);
    flex-shrink: 0;
}

.dark .center-map-legend__gradient-bar {
    border-color: rgb(255 255 255 / 15%);
}

.center-map-legend__gradient-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.center-map-point-result {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    z-index: 1000;
    max-width: min(280px, calc(100% - 1rem));
    padding: 0.5rem 0.625rem;
    border-radius: 0.375rem;
    background: rgb(255 255 255 / 0.92);
    pointer-events: none;
    font-size: 0.75rem;
}

.dark .center-map-point-result {
    background: rgb(31 41 55 / 0.92);
}

.center-map-point-result__layer {
    margin: 0 0 0.25rem;
    font-weight: 600;
    line-height: 1.25;
}

.center-map-point-result__value {
    margin: 0 0 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25;
}

.center-map-point-result__coords,
.center-map-point-result__meta {
    margin: 0;
    color: rgb(107 114 128);
    line-height: 1.35;
}

.dark .center-map-point-result__coords,
.dark .center-map-point-result__meta {
    color: rgb(156 163 175);
}

@media (prefers-reduced-motion: no-preference) {
    .center-route-marker--last .center-route-marker__arrow-wrap {
        animation: center-route-pulse 2s ease-out infinite;
    }
}

@keyframes center-route-pulse {
    0% {
        box-shadow: 0 0 0 0 rgb(37 99 235 / 0.45);
    }
    70% {
        box-shadow: 0 0 0 10px rgb(37 99 235 / 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgb(37 99 235 / 0);
    }
}

.route-track-playback {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-top: 0.5rem;
}

.route-track-playback__btn {
    flex-shrink: 0;
    min-width: 4.5rem;
}

.route-track-playback__scrub {
    flex: 1 1 8rem;
    min-width: 6rem;
    accent-color: #2563eb;
}

.route-track-playback__time {
    flex: 1 1 100%;
    font-size: 0.75rem;
    line-height: 1.25;
    color: rgb(107 114 128);
}

.dark .route-track-playback__time {
    color: rgb(156 163 175);
}

@media (min-width: 640px) {
    .route-track-playback__time {
        flex: 0 1 auto;
        max-width: 14rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

.center-route-tools {
    width: 100%;
}

.center-route-tools__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

@media (max-width: 640px) {
    .center-route-tools__grid {
        grid-template-columns: 1fr;
    }
}

.center-route-tool-card__hint {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    line-height: 1.4;
    color: rgb(107 114 128);
}

.dark .center-route-tool-card__hint {
    color: rgb(156 163 175);
}

.center-route-tool-card__situation {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
}

.center-route-tool-card__situation-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    padding: 0.5rem 0.65rem;
    border-radius: 0.5rem;
    border: 1px solid rgb(226 232 240);
    background: rgb(248 250 252);
}

.dark .center-route-tool-card__situation-item {
    border-color: rgb(55 65 81);
    background: rgb(31 41 55);
}

.center-route-tool-card__situation-line {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.35;
}

.center-route-tool-card__situation-line--muted {
    color: rgb(107 114 128);
}

.dark .center-route-tool-card__situation-line--muted {
    color: rgb(156 163 175);
}

.center-route-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Nested confirm/action modals must sit above history/calendar. */
.center-route-modal--stacked {
    z-index: 1200;
}

/* Keep map overlays below route modals and non-interactive while a modal is open. */
.center-map-modals-open .center-map-overlay-toolbar,
.center-map-modals-open .center-map-overlay-status,
.center-map-modals-open .center-map-bottom-left,
.center-map-modals-open .center-map-point-result {
    z-index: 1;
}

.center-map-modals-open .center-map-overlay-toolbar,
.center-map-modals-open .center-map-overlay-toolbar *,
.center-map-modals-open .center-map-overlay-status,
.center-map-modals-open .center-map-overlay-status *,
.center-map-modals-open .center-map-bottom-left,
.center-map-modals-open .center-map-bottom-left *,
.center-map-modals-open .center-map-point-result,
.center-map-modals-open .center-map-point-result * {
    pointer-events: none !important;
}

.center-route-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgb(15 23 42 / 0.45);
}

.center-route-modal__panel {
    position: relative;
    z-index: 1;
    width: min(1400px, 100%);
    max-height: min(80vh, 720px);
    overflow: auto;
    border-radius: 0.75rem;
    background: rgb(255 255 255);
    padding: 1.25rem;
    box-shadow: 0 20px 40px rgb(0 0 0 / 0.18);
}

.center-route-history-table-wrap {
    overflow-x: auto;
}

.center-route-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.center-route-history-table th,
.center-route-history-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgb(226 232 240);
    vertical-align: middle;
}

.center-route-history-table__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.center-route-history-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 0.375rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid;
}

.center-route-history-port__code {
    margin-left: 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.75;
    color: #64748b;
}

.center-route-history-badge--underway { 
    border-color: #2563eb;
    color: #2563eb;
    background: rgb(37 99 235 / 0.08);
}

.center-route-history-badge--completed { 
    border-color: #16a34a;
    color: #16a34a;
    background: rgb(22 163 74 / 0.08);
}

.center-route-history-badge--anchored { 
    border-color: #d97706;
    color: #d97706;
    background: rgb(217 119 6 / 0.08);
}

.center-route-history-badge--in-port { 
    border-color: #64748b;
    color: #64748b;
    background: rgb(100 116 139 / 0.08);
}

.center-route-history-badge--unknown {
    border-color: #94a3b8;
    color: #64748b;
    background: rgb(148 163 184 / 0.12);
}

.center-route-history-badge--cancelled {
    border-color: #dc2626;
    color: #dc2626;
    background: rgb(220 38 38 / 0.08);
}

.dark .center-route-modal__panel {
    background: rgb(17 24 39);
}

.center-route-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.center-route-modal__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.3;
}

.center-route-modal__empty {
    margin: 0;
    font-size: 0.875rem;
    color: rgb(107 114 128);
}

.dark .center-route-modal__empty {
    color: rgb(156 163 175);
}

.center-route-calendar__nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.center-route-calendar__month {
    font-size: 0.875rem;
    font-weight: 650;
}

.center-route-calendar__weekdays,
.center-route-calendar__grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
}

.center-route-calendar__weekday {
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    color: rgb(107 114 128);
}

.center-route-calendar__day {
    min-height: 2.25rem;
    border-radius: 0.375rem;
    border: 1px solid rgb(229 231 235);
    font-size: 0.75rem;
    line-height: 2.25rem;
    text-align: center;
    background: transparent;
    width: 100%;
    padding: 0;
    position: relative;
}

.dark .center-route-calendar__day {
    border-color: rgb(55 65 81);
}

.center-route-calendar__day--empty {
    border-color: transparent;
    pointer-events: none;
}

.center-route-calendar__day--muted {
    opacity: 0.35;
    cursor: not-allowed;
}

.center-route-calendar__day--enabled {
    cursor: pointer;
    font-weight: 600;
}

.center-route-calendar__day--enabled:hover {
    border-color: rgb(59 130 246);
}

.center-route-calendar__day--selected {
    outline: 2px solid rgb(37 99 235);
    outline-offset: 1px;
}

.center-route-calendar__day--tiles::after {
    content: '';
    position: absolute;
    right: 0.28rem;
    bottom: 0.28rem;
    width: 0.35rem;
    height: 0.35rem;
    border-radius: 9999px;
    background: #0ea5e9;
}

.center-route-calendar__day--underway {
    background: rgba(37, 99, 235, 0.12);
}

.center-route-calendar__day--anchored {
    background: rgba(217, 119, 6, 0.12);
}

.center-route-calendar__day--in-port {
    background: rgba(22, 163, 74, 0.12);
}

.center-route-calendar__day--split-2.center-route-calendar__day--underway.center-route-calendar__day--anchored {
    background: linear-gradient(
        to bottom,
        rgba(37, 99, 235, 0.12) 0 50%,
        rgba(217, 119, 6, 0.12) 50% 100%
    );
}

.center-route-calendar__day--split-2.center-route-calendar__day--underway.center-route-calendar__day--in-port {
    background: linear-gradient(
        to bottom,
        rgba(37, 99, 235, 0.12) 0 50%,
        rgba(22, 163, 74, 0.12) 50% 100%
    );
}

.center-route-calendar__day--split-2.center-route-calendar__day--anchored.center-route-calendar__day--in-port {
    background: linear-gradient(
        to bottom,
        rgba(217, 119, 6, 0.12) 0 50%,
        rgba(22, 163, 74, 0.12) 50% 100%
    );
}

.center-route-calendar__day--split-3.center-route-calendar__day--underway.center-route-calendar__day--anchored.center-route-calendar__day--in-port {
    background: linear-gradient(
        to bottom,
        rgba(37, 99, 235, 0.12) 0 33.33%,
        rgba(217, 119, 6, 0.12) 33.33% 66.66%,
        rgba(22, 163, 74, 0.12) 66.66% 100%
    );
}

.center-route-calendar__detail {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border: 1px solid rgb(226 232 240);
    border-radius: 0.5rem;
    background: rgb(248 250 252);
}

.dark .center-route-calendar__detail {
    border-color: rgb(55 65 81);
    background: rgb(31 41 55);
}

.center-route-calendar__detail-title {
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 650;
}

.center-route-calendar__detail-section + .center-route-calendar__detail-section {
    margin-top: 0.75rem;
}

.center-route-calendar__detail-heading {
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: rgb(107 114 128);
}

.center-route-calendar__detail-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.5rem 0;
    border-top: 1px solid rgb(226 232 240);
}

.dark .center-route-calendar__detail-card {
    border-top-color: rgb(55 65 81);
}

.center-route-calendar__detail-card:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.center-route-calendar__detail-line {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.35;
}

.center-route-calendar__detail-line--muted {
    color: rgb(107 114 128);
}

.dark .center-route-calendar__detail-line--muted {
    color: rgb(156 163 175);
}

.center-route-calendar__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.875rem;
}

.center-route-calendar__legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
}

.center-route-calendar__swatch {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 9999px;
    flex-shrink: 0;
}

.center-route-calendar__swatch--tiles {
    background: #0ea5e9;
}

.center-route-calendar__swatch--underway {
    background: #2563eb;
}

.center-route-calendar__swatch--anchored {
    background: #d97706;
}

.center-route-calendar__swatch--in-port {
    background: #16a34a;
}
