:root {
    --base-port-color: #3498db;
    --color-white: #ffffff;
    --color-on-accent: #ffffff;
    --color-text: #2c3e50;
    --color-text-subtle: #495057;
    --color-text-muted: #6c757d;
    --color-surface: #f8f9fa;
    --color-surface-alt: #eef2f7;
    --color-panel: #ffffff;
    --color-panel-elevated: #ffffff;
    --color-input-bg: #ffffff;
    --color-border: #dee2e6;
    --color-border-soft: #e9ecef;
    --color-input-border: #ced4da;
    --color-success: #28a745;
    --color-warning: #f39c12;
    --color-danger: #dc3545;
    --color-flight: #27ae60;
    --color-port: #3498db;

    --bg-success-soft: #d4edda;
    --text-success-strong: #155724;
    --border-success-soft: #c3e6cb;

    --bg-danger-soft: #fee;
    --text-danger-strong: #c33;
    --border-danger-soft: #fcc;

    --bg-warning-soft: #fff3cd;
    --text-warning-strong: #856404;
    --border-warning-soft: #ffeaa7;

    --bg-info-soft: #e7f3ff;
    --text-info-strong: #004085;
    --border-info-soft: #b8d8e8;

    --bg-row-hover: #f5f5f5;
    --bg-row-selected: #e3f2fd;
    --bg-table-header: #2c3e50;
    --color-table-header-text: #ffffff;
    --bg-modal-overlay: rgba(0, 0, 0, 0.6);
    --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.1);

    --color-port-status-closed-bg: #f8d7da;
    --color-port-status-closed-text: #721c24;

    --font-title: 'Montserrat','Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Montserrat','Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Recursive', 'Fira Code', 'Consolas', monospace;
    --font-parchment: 'IM Fell English SC', 'IM Fell English', Georgia, serif;
    --map-bg: #1a3a52;
    --map-text-muted: #6c757d;
    --map-text-subtle: #495057;
    --map-text-bright: #ffffff;
    --map-label-default: #a0c4e0;
    --map-label-capital: #c8a0d8;
    --map-label-current: #6be88a;
    --map-overlay-shadow: rgba(0, 0, 0, 0.15);
    --status-bg-start: #2c3e50;
    --status-bg-end: #34495e;
    --status-accent-flying: var(--color-flight);
    --status-accent-docked: var(--color-port);
    --status-accent-balance: #f1c40f;
    --status-muted: #95a5a6;

    /* Parchment / vellum palette + texture */
    --parchment-base: #e8d6b0;
    --parchment-ink: #3a2614;
    --parchment-ink-muted: #6b4a2b;
    --parchment-highlight: rgba(255, 240, 210, 0.45);
    --parchment-vignette-edge: rgba(80, 50, 20, 0.35);
    --parchment-fiber-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.45  0 0 0 0 0.32  0 0 0 0 0.18  0 0 0 0.35 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    --parchment-stain-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='1200' height='1200'><filter id='f'><feTurbulence type='fractalNoise' baseFrequency='0.008' numOctaves='3' seed='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.38  0 0 0 0 0.26  0 0 0 0 0.12  0 0 0 0.22 0'/></filter><rect width='100%25' height='100%25' filter='url(%23f)'/></svg>");
}

[data-theme="dark"] {
    --color-text: #e6edf5;
    --color-text-subtle: #c9d3df;
    --color-text-muted: #8a96a6;
    --color-surface: #1a2230;
    --color-surface-alt: #20293a;
    --color-panel: #1a2230;
    --color-panel-elevated: #232d3f;
    --color-input-bg: #11192a;
    --color-border: #2e3a4d;
    --color-border-soft: #283142;
    --color-input-border: #3a4660;

    --bg-success-soft: rgba(40, 167, 69, 0.18);
    --text-success-strong: #6ee896;
    --border-success-soft: rgba(40, 167, 69, 0.4);

    --bg-danger-soft: rgba(220, 53, 69, 0.18);
    --text-danger-strong: #ff9aa2;
    --border-danger-soft: rgba(220, 53, 69, 0.4);

    --bg-warning-soft: rgba(243, 156, 18, 0.16);
    --text-warning-strong: #ffd486;
    --border-warning-soft: rgba(243, 156, 18, 0.4);

    --bg-info-soft: rgba(52, 152, 219, 0.18);
    --text-info-strong: #8ecaf0;
    --border-info-soft: rgba(52, 152, 219, 0.4);

    --bg-row-hover: #232d3f;
    --bg-row-selected: rgba(52, 152, 219, 0.22);
    --bg-table-header: #0f1722;
    --color-table-header-text: #e6edf5;
    --bg-modal-overlay: rgba(0, 0, 0, 0.7);
    --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.6);
    --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.4);

    --color-port-status-closed-bg: rgba(220, 53, 69, 0.18);
    --color-port-status-closed-text: #ff9aa2;

    --map-text-muted: #8a96a6;
    --map-text-subtle: #c9d3df;
    --map-overlay-shadow: rgba(0, 0, 0, 0.5);

    color-scheme: dark;
}

/* Global font settings */
body, html {
    font-family: var(--font-body);
    font-weight: 400;
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    background: var(--map-bg);
}

/* Form controls don't inherit font-family from the page by default in most browsers -
   without this they fall back to the OS UI font instead of the theme's fonts. */
button, input, select, textarea, optgroup, option {
    font-family: inherit;
}

/* Headings - Bold */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-title), sans-serif;
    font-weight: 700;
    color: var(--color-text);
}

/* Subheadings - Lighter color and italic */
h4, h5, h6,
.subtitle,
.port-status,
.port-subtitle {
    font-weight: 500;
    color: var(--color-text-muted);
    font-style: italic;
}

/* Prices and currency values use monospace */
.price-value, 
.price-buy, 
.price-sell, 
.price-here, 
.price-there, 
.profit,
.distance, 
.eta,
.summary-item .value,
.trade-summary .value {
    font-family: var(--font-mono);
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

/* Journey Planner Table Styles */
.journey-planner {
    padding: 0.5rem;
}

.journey-planner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.journey-planner-header .header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.journey-planner-header .header-left h2 {
    margin: 0;
}

.journey-planner-header .header-journey-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    background: var(--color-surface);
    border-radius: 6px;
    font-size: 0.9rem;
}

.journey-planner-header .journey-arrow {
    color: var(--color-text-muted);
    font-weight: bold;
}

.journey-planner-header .journey-distance {
    color: var(--color-text-muted);
    margin-left: 0.5rem;
}

.journey-planner-header .journey-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: 0.5rem;
}

.journey-planner-header .btn-go-now {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-weight: 700;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.journey-planner-header .btn-go-now:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.journey-planner-header .btn-start {
    margin-left: 0.5rem;
}

.journey-table-container {
    overflow-x: auto;
    margin: 0.5rem 0;
}

.journey-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-panel);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.journey-table th {
    background: var(--bg-table-header);
    color: var(--color-table-header-text);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
}

.journey-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}

.destination-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.destination-row:hover {
    background-color: var(--bg-row-hover);
}

.destination-row.selected {
    background-color: var(--bg-row-selected);
}

.port-name {
    font-weight: 500;
}

.distance, .eta {
    font-family: monospace;
    font-size: 0.95em;
}

.btn-link {
    background: none;
    border: none;
    color: var(--color-port);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.9em;
    text-decoration: underline;
}

.btn-link:hover {
    filter: brightness(0.9);
}

.expandable-row {
    background-color: var(--color-surface);
}

.expandable-row td {
    padding: 0;
}

.port-economy-details {
    padding: 1rem 1.5rem;
    background-color: var(--color-surface);
    border-left: 4px solid var(--color-port);
}

.port-economy-details h4 {
    margin: 0 0 1rem 0;
    color: var(--color-text);
    font-size: 1.1em;
}

.prices-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-panel);
    border-radius: 4px;
    overflow: hidden;
}

.prices-table th {
    background: var(--bg-table-header);
    color: var(--color-table-header-text);
    padding: 8px 12px;
    font-size: 0.85em;
    text-align: left;
}

.prices-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9em;
    color: var(--color-text);
}

.price-buy {
    color: #e74c3c;
    font-weight: 500;
}

.margin {
    font-family: monospace;
}

.margin.good {
    color: #27ae60;
    font-weight: 600;
}

.margin.poor {
    color: #e74c3c;
}

.loading-prices {
    color: #7f8c8d;
    font-style: italic;
}

.no-data {
    color: var(--color-text-muted);
    text-align: center;
    padding: 1rem;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.dashboard-header h2 {
    margin: 0;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-primary {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-primary:hover:not(:disabled) {
    background: #2980b9;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error-message {
    background: var(--bg-danger-soft);
    color: var(--text-danger-strong);
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--text-danger-strong);
}

.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
}

.error-state .error-message {
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.refresh-error-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-warning-soft);
    color: var(--text-warning-strong);
    border: 1px solid var(--border-warning-soft);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.refresh-error-banner .dismiss-btn {
    background: none;
    border: 1px solid currentColor;
    color: var(--text-warning-strong);
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
}

.refresh-error-banner .dismiss-btn:hover {
    background: var(--text-warning-strong);
    color: var(--color-panel);
}

.market-toast {
    position: fixed;
    top: 14px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    max-width: calc(100vw - 2rem);
    text-align: center;
    /* Keep notifications above modal overlays (z-index: 1000). */
    z-index: 1100;
    padding: 0.5rem 0.7rem;
    border-radius: 6px;
    background: rgba(34, 49, 63, 0.95);
    color: #f1f7ff;
    border: 1px solid rgba(123, 184, 255, 0.35);
    font-size: 0.78rem;
    font-family: var(--font-mono);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.safety-net-dialog {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.safety-net-image {
    width: 100%;
}

.safety-net-image img {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: 8px;
    background: #2a2a35;
}

.safety-net-text {
    margin: 0;
    line-height: 1.55;
    color: var(--color-text);
}

.safety-net-text em {
    color: var(--color-text-subtle);
}

.safety-net-actions {
    display: flex;
    justify-content: flex-end;
}

/* Journey Layout - Side by Side */
.journey-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.flying-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 0.75rem;
    margin-top: 0.5rem;
    align-items: start;
}

.flying-status {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (max-width: 1200px) {
    .flying-layout {
        grid-template-columns: 1fr 1fr;
    }
}

.flying-map {
    min-height: 500px;
}

@media (max-width: 1000px) {
    .flying-layout {
        grid-template-columns: 1fr;
    }
    
    .flying-map {
        min-height: 400px;
    }
}

@media (max-width: 1200px) {
    .journey-layout {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 900px) {
    .journey-layout {
        grid-template-columns: 1fr;
    }
}

.journey-map-section {
    min-height: 400px;
    overscroll-behavior: contain;
    touch-action: none;
}

.journey-map-section .canvas-map-container {
    min-height: 400px;
}

.journey-list-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.journey-table-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

/* World Map Styles */
.world-map {
    background: #1a3a52;
    border-radius: 6px;
    border: 1px solid #0d2135;
    position: relative;
    overflow: hidden;
    touch-action: none;
    overscroll-behavior: contain;
}

.world-map .map-empty-state {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 480px;
    color: #7f8c8d;
    font-style: italic;
}

.loading-placeholder {
    opacity: 0.6;
    font-style: italic;
}



.world-map .cargo-filter-btn {
    padding: 3px 10px;
    border: 1px solid var(--color-input-border);
    border-radius: 4px;
    background: var(--color-panel);
    color: var(--color-text-subtle);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.world-map .cargo-filter-btn:hover {
    background: var(--color-border-soft);
}

.world-map .cargo-filter-btn.active {
    background: var(--color-port);
    color: #fff;
    border-color: var(--color-port);
}

.port-price-label {
    fill: #ecf0f1;
    font-weight: 600;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.player-marker {
    cursor: pointer;
}



.route-line {
    stroke: #f39c12;
    stroke-width: 2;
    stroke-dasharray: 5,3;
    animation: dash 1s linear infinite;
    vector-effect: non-scaling-stroke;
}

.flight-route-line {
    stroke: #27ae60;
    stroke-width: 1.5;
    stroke-dasharray: 3,3;
    opacity: 0.85;
    vector-effect: non-scaling-stroke;
}

.departure-route-line {
    stroke: #f39c12;
    stroke-width: 1.5;
    stroke-dasharray: 2,4;
    opacity: 0.9;
    vector-effect: non-scaling-stroke;
}

@keyframes dash {
    to {
        stroke-dashoffset: -16;
    }
}

.port-marker {
    cursor: pointer;
}


.world-map .map-legend {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(255,255,255,0.95);
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
    display: flex;
    gap: 12px;
    font-size: 11px;
    z-index: 10;
    color: #333;
}

.world-map .legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.world-map .legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.world-map .legend-dot.flying {
    background: #27ae60;
}

.world-map .legend-dot.docked {
    background: #e74c3c;
}

.world-map .legend-dot.open {
    background: #3498db;
}

.world-map .port-circle {
    fill: var(--base-port-color);
    stroke: white;
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.world-map .port-marker.current .port-circle {
    fill: #27ae60;
}

.world-map .port-marker.previous .port-circle {
    fill: #e74c3c;
}

.world-map .port-marker.selected .port-circle {
    fill: #f39c12;
}

.world-map .port-marker.capital .port-circle {
    fill: #9b59b6;
}

.world-map .port-label {
    font-size: 4px;
    fill: #a0c4e0;
    font-weight: 500;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.world-map .port-label.capital-label {
    font-size: 5px;
    font-weight: 700;
    fill: #c8a0d8;
}

.world-map .player-marker.flying .player-circle {
    fill: #27ae60;
}

.world-map .player-marker.docked .player-circle {
    fill: #e74c3c;
}

.world-map .player-marker.docked .player-circle-glow {
    stroke: rgba(231, 76, 60, 0.5);
    stroke-width: 4;
    vector-effect: non-scaling-stroke;
}

.world-map .player-marker.flying .player-circle-glow {
    stroke: rgba(39, 174, 96, 0.5);
    stroke-width: 4;
    vector-effect: non-scaling-stroke;
}

.world-map .player-circle {
    stroke: #fff;
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}

.world-map .player-label {
    font-size: 5px;
    font-weight: 700;
    background-color: #e1e5ea;
    fill: #1a1a1a;
    pointer-events: none;
}

.world-map .player-status {
    font-size: 4px;
    fill: #ffffff;
    font-weight: 500;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* CanvasMap component styles moved to Client/Components/Home/CanvasMap.razor.css */

/* Login Page Styles */
/* Reusable parchment / vellum surface. Apply to any element that wants the texture. */
.parchment {
    background-color: var(--parchment-base);
    background-image:
        radial-gradient(ellipse at center, transparent 0%, var(--parchment-vignette-edge) 100%),
        var(--parchment-fiber-image),
        var(--parchment-stain-image);
    background-blend-mode: normal, multiply, multiply;
    background-size: auto, 400px 400px, cover;
    background-repeat: repeat, repeat, no-repeat;
    background-position: center, center, center;
    color: var(--parchment-ink);
}

.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--parchment-base);
    background-image:
        radial-gradient(ellipse at center, transparent 0%, var(--parchment-vignette-edge) 100%),
        var(--parchment-fiber-image),
        var(--parchment-stain-image);
    background-blend-mode: normal, multiply, multiply;
    background-size: auto, 400px 400px, cover;
    background-repeat: repeat, repeat, no-repeat;
    background-position: center, center, center;
}

.login-vt-corner {
    font-size: 0.8rem;
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--parchment-ink);
    line-height: 1;
    text-decoration: none;
    transition: color 120ms ease, background 120ms ease;
}

.login-vt-corner:hover {
    color: var(--parchment-base);
    background: var(--parchment-ink);
    border-color: var(--parchment-ink);
}

.login-vt-corner p {
    margin: 0;
}

.login-bottom-left {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.login-privacy-link {
    font-size: 0.8rem;
    color: var(--parchment-ink);
    text-decoration: underline;
    transition: color 120ms ease, background 120ms ease;
}

.login-privacy-link:hover {
    color: var(--parchment-base);
    background: var(--parchment-ink);
}


.login-container {
    text-align: center;
    margin: auto 0;
}

.login-title {
    font-family: var(--font-parchment);
    text-align: center;
    color: var(--parchment-ink);
    font-weight: 500;
    font-size: 5rem;
    line-height: 1;
    letter-spacing: 0.2em;
    margin: 0.5rem 0 1.5rem;
    padding: 0;
    text-shadow: 0 1px 0 var(--parchment-highlight);
}

.login-container h1 {
    text-align: center;
    color: var(--parchment-ink);
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.login-container .subtitle {
    font-size: 1.4rem;
    margin-bottom: 2rem;
}

.login-vt-logo {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 50%;
    background: transparent;
}

.login-card {
    background: var(--parchment-base);
    max-width: 330px;
    margin: 0 auto;
    padding: 1rem;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    padding: 0.35rem;
    background: var(--parchment-stain-image);
    border-radius: 999px;
    margin-bottom: 1.2rem;
}

.login-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--parchment-ink);
    font-size: 0.95rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.login-tab:hover {
    color: #26303b;
    background: rgba(255, 255, 255, 0.65);
}

.login-tab.active {
    background: var(--parchment-base);
    color: var(--parchment-ink-muted);
    box-shadow: 0 6px 18px rgba(27, 39, 51, 0.12);
}

.login-tab-panel {
    text-align: left;
}

.login-panel-copy {
    margin: 0 0 1rem;
    color: var(--parchment-ink);
    font-size: 0.95rem;
    line-height: 1.5;
}

.invite-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--parchment-ink);
    margin-bottom: 0.4rem;
}

.invite-input {
    width: 90%;
    background: var(--parchment-base) ;
    border: 1px solid var(--parchment-ink);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.invite-input:focus {
    outline: none;
    border-color: var(--parchment-ink);
    box-shadow: 0 0 0 3px rgba(77, 103, 183, 0.16);
}

.btn-github {
    font-family: var(--font-body);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 4px;
    background: #24292e;
    color: white;
    border: none;
    border-radius: 32px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-github:hover {
    background: #1a1e22;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(36, 41, 46, 0.4);
}

.btn-github svg {
    flex-shrink: 0;
}

.btn-discord {
    font-family: var(--font-body);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 4px;
    margin-top: 12px;
    background: #5865F2;
    color: white;
    border: none;
    border-radius: 32px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-discord:hover {
    background: #4752c4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(88, 101, 242, 0.4);
}

.btn-discord svg {
    flex-shrink: 0;
}

.btn-gitlab {
    font-family: var(--font-body);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 4px;
    background: #fc6d26;
    color: white;
    border: none;
    border-radius: 32px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-gitlab:hover {
    background: #e05a18;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(252, 109, 38, 0.4);
}

.btn-gitlab svg {
    flex-shrink: 0;
}

.btn-google {
    font-family: var(--font-body);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 4px;
    background: #4285F4;
    color: white;
    border: none;
    border-radius: 32px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-google:hover {
    background: #357ae8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4);
}

.btn-google svg {
    flex-shrink: 0;
}

.btn-facebook {
    font-family: var(--font-body);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 4px;
    background: #1877F2;
    color: white;
    border: none;
    border-radius: 32px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-facebook:hover {
    background: #166fe5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.4);
}

.btn-facebook svg {
    flex-shrink: 0;
}

.login-provider-row {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.login-provider-row > button {
    width: auto;
    flex: 0 0 auto;
    margin: 0;
    padding: 0.6rem;
    border-radius: 50%;
    aspect-ratio: 1 / 1;
}

.login-provider-row > button:disabled,
.login-provider-row > button:disabled:hover {
    opacity: 0.4;
    filter: grayscale(0.75);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.login-info {
    margin-top: 0.75rem;
    color: #6c757d;
    font-size: 0.9rem;
}

@media (max-width: 520px) {
    .login-tabs {
        grid-template-columns: 1fr;
        border-radius: 16px;
    }

    .login-tab {
        border-radius: 12px;
    }
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-danger {
    background: var(--bg-danger-soft);
    color: var(--parchment-ink);
    border: 1px solid var(--border-danger-soft);
}

.login-alert {
    max-width: 330px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}

/* Authentication prompt styles */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Player header with avatar */
.player-header .header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.player-header .header-avatar {
    width: 48px !important;
    height: 48px !important;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-header .avatar-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    border-radius: 50%;
}

.player-header .avatar-placeholder {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.player-header .header-title h1 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--color-text);
}

.player-header .subtitle {
    margin: 0.25rem 0 0 0;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

/* Also style as anchor tag */
a.btn-github {
    text-decoration: none;
    display: inline-flex;
}

/* Home Page Styles */
.player-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.player-card {
    padding: 1rem;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    background: var(--color-panel);
    color: var(--color-text);
}

.player-card:hover {
    border-color: var(--color-port);
    background-color: var(--bg-row-hover);
}

.player-name {
    font-size: 1.2rem;
    font-weight: bold;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-title {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.header-title h1 {
    margin: 0;
}

.subtitle {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 1.1rem;
    font-weight: 500;
}

.dashboard, .journey-planner, .journeys-list {
    background: var(--color-surface);
    padding: 1rem;
    border-radius: 12px;
    color: var(--color-text);
}

.dashboard-header, .journeys-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.journeys-header {
    margin-bottom: 1rem;
}

.journeys-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.journey-card {
    background: var(--color-panel);
    border: 2px solid var(--color-border);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--color-text);
}

.journey-card:hover {
    border-color: var(--color-port);
    box-shadow: var(--shadow-card);
}

.journey-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.journey-route {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.1rem;
}

.journey-route .arrow {
    color: var(--color-port);
    font-weight: bold;
}

.journey-route .port {
    font-weight: 500;
}

.journey-card-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border-soft);
}

.journey-card-actions button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Compact Ship Info Bar */
.compact-ship-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding: 0.4rem 0.5rem;
    background: var(--color-border-soft);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    border: 1px solid var(--color-border);
}

.compact-ship-info .ship-name {
    font-weight: 600;
    color: var(--color-text-subtle);
    margin-right: 0.25rem;
}

.compact-ship-info .ship-stat {
    padding: 0.15rem 0.4rem;
    background: var(--color-panel);
    border-radius: 3px;
    border: 1px solid var(--color-input-border);
    font-size: 0.8rem;
    color: var(--color-text);
    white-space: nowrap;
}

.compact-ship-info .ship-stat.money {
    background: var(--bg-success-soft);
    border-color: var(--border-success-soft);
    color: var(--text-success-strong);
    font-weight: 600;
}

.compact-ship-info .ship-stat.cargo {
    cursor: help;
}

.journey-metrics, .journey-planned-info {
    background: var(--color-panel);
    border-radius: 8px;
    border: 1px solid var(--color-border);
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    color: var(--color-text-subtle);
    display: grid;
    gap: 0.4rem;
}

.airship-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1rem 0;
}

.airship {
    font-size: 4rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.journey-info {
    margin-top: 1rem;
    text-align: center;
}

.journey-info p {
    margin: 0.5rem 0;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-planning {
    background-color: #6c757d;
    color: white;
}

.status-flying {
    background-color: #28a745;
    color: white;
}

.status-paused {
    background-color: #ffc107;
    color: #212529;
}

.status-completed {
    background-color: #007bff;
    color: white;
}

.ship-info h3 {
    margin: 0 0 1rem 0;
    color: #495057;
    font-size: 1.4rem;
}

.btn-warning, .btn-danger {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: opacity 0.2s;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

button:hover:not(:disabled) {
    opacity: 0.9;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* New UI Overhaul - App Shell */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
}

.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 0;
    /* In-flight dock geometry, single source of truth:
       --dock-panel-width  the expanded panel's own width
       --dock-edge         the sliver left visible (just the toggle handle) when collapsed
       --dock-width        how far the map / ship view are inset from the left edge.
       Collapsing the dock only changes --dock-width, so the map reclaims the space. */
    --dock-panel-width: min(210px, 55vw);
    --dock-edge: 30px;
    --dock-width: var(--dock-panel-width);
    /* Level editor split-view: a permanent left panel (not a floating overlay) while
       editor mode is on, so the map stays fully clickable beside it - port selection
       and Relocate-click both still work. Single width variable shared by the panel's
       own CSS and the map's left-inset below, so they can never drift apart. */
    --editor-panel-width: clamp(320px, 25vw, 480px);
}

/* Collapsed: the map reclaims the full width and the toggle handle simply floats
   on top of its left edge (handle stays visible because the panel slides off, not 0-width). */
.main-content--dock-collapsed {
    --dock-width: 0px;
}

/* While flying, push the full-screen surfaces (map canvas, 3D ship view) to the
   right of the dock so the in-flight panel sits beside them, not over them. Both
   are positioned against .main-content (inset: 0); overriding left + width: auto
   shrinks them from the left, and their resize observers redraw to fit. The
   doubled .main-content class wins specificity over the scoped component rules. */
.main-content.main-content--flying .canvas-map-container,
.main-content.main-content--flying .ship-view {
    left: var(--dock-width);
    width: auto;
    transition: left 0.25s ease;
}

/* Editor mode: reserve --editor-panel-width on the left for the docked port editor,
   same mechanism as the in-flight dock above. Not additive with it - editing while
   also mid-flight is an unhandled edge case, same as it was with the old floating panel. */
.main-content.main-content--editor .canvas-map-container {
    left: var(--editor-panel-width);
    width: auto;
    transition: left 0.2s ease;
}

.map-spotify-prompt {
    position: absolute;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: inline-flex;
    align-items: stretch;
    padding: 0;
    border-radius: 999px;
    background: #1db954;
    color: #062b13;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.map-spotify-prompt__link {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    color: inherit;
    text-decoration: none;
    transition: background 120ms ease;
}

.map-spotify-prompt__link:hover {
    background: rgba(0, 0, 0, 0.08);
}

.map-spotify-prompt__label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
    line-height: 1;
}

.map-spotify-prompt__spotify {
    width: 1.1rem;
    height: 1.1rem;
    flex: 0 0 auto;
    display: block;
}

.map-spotify-prompt__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    padding: 0 0.5rem;
    border: none;
    background: rgba(0, 0, 0, 0.12);
    color: #062b13;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background 120ms ease;
}


/* Prevent body/html scroll */
html, body {
    overflow: hidden;
    height: 100%;
}

/* Modal Dialog */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-dialog {
    background: var(--color-panel);
    color: var(--color-text);
    border-radius: 12px;
    box-shadow: var(--shadow-modal);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-small {
    width: 400px;
    max-width: 100%;
}

.modal-medium {
    width: 600px;
    max-width: 100%;
}

.modal-large {
    width: 800px;
    max-width: 100%;
}

.modal-xl {
    width: 1100px;
    max-width: 100%;
}

.modal-fullscreen {
    width: 95vw;
    height: 90vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border-soft);
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--color-text);
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close-btn:hover {
    background: var(--color-surface);
    color: var(--color-text-subtle);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--color-border-soft);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Shared action-row layout for dialogs that render their own buttons
   inside ModalDialog's ChildContent instead of using modal-footer. */
.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}


/* In-Flight Panel (right side, vertically centred) */
.in-flight-panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    /* Above the 3D ship view (150) but below the player menu (200) / toasts / modals. */
    z-index: 160;
    width: var(--dock-panel-width);
    background: var(--color-panel-elevated);
    color: var(--color-text);
    padding: 1.25rem 1rem;
    /* Docked flush to the left edge: square corners, only the trailing edge bordered. */
    border-radius: 0;
    border: 1px solid var(--color-border);
    border-left: 0;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    font-size: 0.9rem;
    transition: transform 0.25s ease;
}

/* Slide the panel fully off the left edge; the toggle handle protrudes past the
   right border, so after the slide it's the only thing left on screen. */
.in-flight-panel--collapsed {
    transform: translateX(-100%);
}

/* Edge toggle handle, halfway down the outer (right) edge of the panel. It sits
   outside the panel's right border so it stays visible once the panel slides away. */
.in-flight-panel__toggle {
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    width: var(--dock-edge);
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    color: var(--color-text);
    background: var(--color-panel-elevated);
    border: 1px solid var(--color-border);
    border-left: 0;
    border-radius: 0 8px 8px 0;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: background 120ms ease;
}

.in-flight-panel__toggle:hover {
    background: var(--bg-row-hover);
}

.in-flight-panel__heading {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.in-flight-panel__heading-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.in-flight-panel__destination {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
}

.in-flight-panel__divider {
    border: 0;
    border-top: 1px solid var(--color-border-soft);
    margin: 0;
}

.in-flight-panel__rows {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.in-flight-panel__row {
    /* Stack label over value so each row stays narrow in the docked sidebar. */
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.in-flight-panel__label {
    color: var(--color-text-muted);
}

.in-flight-panel__value {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--color-text);
}

.in-flight-panel__auto-sell {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.65rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
}

.in-flight-panel__auto-sell input {
    flex: 0 0 auto;
    margin-top: 0.15rem;
    accent-color: var(--color-port);
}

.in-flight-panel__auto-sell span {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    line-height: 1.25;
}

.in-flight-panel__auto-sell strong {
    font-size: 0.82rem;
}

.in-flight-panel__auto-sell small {
    color: var(--color-text-muted);
    font-size: 0.72rem;
}

.in-flight-panel__metric {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.in-flight-panel__bar {
    width: 100%;
    height: 8px;
    background: var(--color-surface-alt);
    border-radius: 999px;
    overflow: hidden;
}

.in-flight-panel__bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 250ms ease, background-color 250ms ease;
}

.in-flight-panel__bar-fill--hull {
    background: var(--color-success);
}

.in-flight-panel__bar-fill--hull-warn {
    background: var(--color-warning);
}

.in-flight-panel__bar-fill--hull-danger {
    background: var(--color-danger);
}

.in-flight-panel__hull-note {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: var(--color-warning);
    line-height: 1.3;
}

.in-flight-panel__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    /* Anchor the buttons to the bottom of the full-height docked panel. */
    margin-top: auto;
}

.in-flight-panel__btn {
    flex: 1;
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-alt);
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
}

.in-flight-panel__btn:hover:not(:disabled) {
    background: var(--bg-row-hover);
}

.in-flight-panel__btn--danger {
    background: var(--bg-danger-soft);
    border-color: var(--border-danger-soft);
    color: var(--text-danger-strong);
}

.in-flight-panel__btn--danger:hover:not(:disabled) {
    background: var(--border-danger-soft);
}

.in-flight-panel__btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.flying-error {
    background: var(--bg-danger-soft);
    border: 1px solid var(--border-danger-soft);
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-danger-strong);
}

/* Journeys Panel */
.journeys-panel {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: color-mix(in srgb, var(--color-panel) 95%, transparent);
    color: var(--color-text);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 100;
    min-width: 250px;
    max-width: 350px;
    max-height: 300px;
    overflow: hidden;
}

.journeys-panel.collapsed {
    max-height: 42px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border-soft);
}

.panel-header:hover {
    background: var(--color-surface);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--color-text);
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 0.75rem;
}

.panel-content {
    padding: 0.75rem;
    max-height: 250px;
    overflow-y: auto;
}

.no-journeys {
    color: var(--color-text-muted);
    font-style: italic;
    margin: 0;
    text-align: center;
    padding: 0.5rem;
}

.journeys-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.journey-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border-soft);
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
}

.journey-item:hover {
    background: var(--bg-row-hover);
}

.journey-item.selected {
    border-color: var(--color-port);
    background: var(--bg-info-soft);
}

.journey-route {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.journey-route .from,
.journey-route .to {
    font-weight: 500;
}

.journey-route .arrow {
    color: var(--color-text-muted);
}

.journey-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

.btn-small.btn-start {
    background: #27ae60;
    color: white;
}

.btn-small.btn-start:hover:not(:disabled) {
    background: #219a52;
}

.btn-small.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-small.btn-delete:hover:not(:disabled) {
    background: #c0392b;
}

.btn-small:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-new-journey {
    padding: 0.5rem 1rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-new-journey:hover {
    background: #2980b9;
}

.panel-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.panel-buttons .btn-new-journey {
    flex: 1;
    width: auto;
}

.btn-trade {
    padding: 0.5rem 1rem;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-trade:hover {
    background: #219a52;
}

.journey-error {
    background: var(--bg-danger-soft);
    color: var(--text-danger-strong);
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* Journey Planner Dialog */
.journey-dialog {
    min-width: 300px;
}

.journey-selection {
    margin-bottom: 1rem;
}

.journey-route-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1rem;
}

.journey-route-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}


.route-point.from {
    text-align: left;
}

.route-point.to {
    text-align: right;
}

.route-label {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.route-port {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
}

.route-port.placeholder {
    color: var(--color-text-muted);
    font-style: italic;
}

.route-info {
    color: var(--color-text-muted);
}

.route-arrow {
    font-size: 1.25rem;
    color: var(--color-port);
    font-weight: 700;
}

.route-metrics {
    margin-top: 0.85rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.route-metric {
    background: var(--color-panel);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
}

.route-metric-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin-bottom: 0.15rem;
}

.route-metric-value {
    display: block;
    font-size: 0.95rem;
    color: var(--color-text);
    font-weight: 600;
}

.route-metric-value--warn {
    color: var(--color-warning);
}

.route-metric-sub {
    display: block;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-top: 0.1rem;
}

.destinations-container {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.destinations-header {
    display: grid;
    grid-template-columns: 1fr 80px 80px;
    background: var(--bg-table-header);
    color: var(--color-table-header-text);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.destinations-header .dest-col {
    padding: 0.75rem;
}

.destinations-list {
    max-height: 250px;
    overflow-y: auto;
}

.destination-row {
    display: grid;
    grid-template-columns: 1fr 80px 80px;
    padding: 0.75rem;
    border-bottom: 1px solid var(--color-border-soft);
    cursor: pointer;
    transition: background 0.15s;
}

.destination-row:hover {
    background: var(--bg-row-hover);
}

.destination-row.selected {
    background: var(--bg-info-soft);
    border-color: var(--color-port);
}

.destination-row:last-child {
    border-bottom: none;
}

.dest-col {
    padding: 0 0.5rem;
}

.dest-col.port-name {
    font-weight: 500;
    color: var(--color-text);
}

.dest-col.distance,
.dest-col.eta {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--color-text-subtle);
}

.journey-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Responsive - 1024x768 */
@media (max-width: 1024px) {
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-large {
        width: 100%;
    }
    
    .journeys-panel {
        max-width: 300px;
    }

    .journey-route-header {
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .journey-route-header {
        flex-direction: column;
        align-items: stretch;
    }

    .route-point.to {
        text-align: left;
    }

    .route-arrow {
        align-self: center;
        transform: rotate(90deg);
    }
}

@media (max-height: 600px) {
    .modal-body {
        padding: 0.75rem;
    }
}

.travel-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.travel-destination-picker {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.travel-destination-picker label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted, #555);
}

.travel-destination-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border, #ccc);
    border-radius: 6px;
    font-size: 0.95rem;
    color: var(--color-text-muted, #555);
    background: var(--color-surface, #fff);
}

.travel-disabled-note {
    color: var(--color-text-muted, #777);
    font-size: 0.85rem;
    margin: 0;
}

.auto-sell-option {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    color: var(--color-text);
    font-size: 0.9rem;
    cursor: pointer;
}

.auto-sell-option input {
    margin-top: 0.2rem;
}

.auto-sell-option small {
    display: block;
    margin-top: 0.15rem;
    color: var(--color-text-muted);
    font-size: 0.78rem;
}

.travel-hull-note {
    color: var(--color-warning);
    font-size: 0.8rem;
    margin: 0.5rem 0 0;
    line-height: 1.4;
}

.trading-compare-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.trading-compare-picker label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted, #555);
}

.trading-compare-select {
    padding: 0.4rem 0.6rem;
    border: 2px solid var(--color-border, #ccc);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--color-text-muted, #777);
    background: var(--color-surface, #fff);
    min-width: 220px;
}

.icon {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.125em;
    flex-shrink: 0;
}
