/* ============================================================
   MERIDIUM STAR TRADERS - WAR ROOM UI FRAMEWORK
   Consolidated component system for space trading game interface
   
   Includes: Base styles, Grid, Panels, Cards, Tables, Lists,
   Tabs, Buttons, Forms, Tags, Alerts, Planet Systems, Maps,
   Fleet Management, Shipyard, Avatars, Modals, Utilities
============================================================ */

/* ============================================================
   ROOT VARIABLES
============================================================ */
:root {
    /* Background colors */
    --wr-bg-panel: rgba(255,255,255,0.03);
    --wr-bg-panel-alt: rgba(255,255,255,0.05);
    
    /* Border colors */
    --wr-border: rgba(201,168,106,0.25);
    --wr-border-soft: rgba(201,168,106,0.35);
    --wr-border-strong: rgba(201,168,106,0.6);
    
    /* Text colors */
    --wr-text-main: #e3e7ec;
    --wr-text-soft: #aaa;
    --wr-text-muted: #888;
    
    /* Accent colors */
    --wr-accent: #c9a86a;
    --wr-arcane: #4aa3ff;
    --wr-accent-soft: rgba(201,168,106,0.15);
    --wr-accent-hover: rgba(201,168,106,0.12);
    --wr-accent-strong: rgba(201,168,106,0.18);
    
    /* Planet classification colors */
    --planet-m: #4a9d5f;
    --planet-l: #7eb3d4;
    --planet-k: #d4a574;
    --planet-h: #b85450;
    --planet-d: #8a8a8a;
    --planet-j: #c89b6a;
    --planet-t: #5a8fb4;
    --planet-p: #9a7fb8;
    --planet-o: #4a7a9d;
    --planet-n: #a8a8a8;
    --planet-y: #ffcc66;
    --planet-r: #cc6666;
}

/* ============================================================
   GLOBAL BASELINE STYLES
============================================================ */
html, body {
    margin: 0;
    padding: 0;
    background: #14161a;
    color: var(--wr-text-main);
    font-family: 'Segoe UI', sans-serif;
}

* {
    box-sizing: border-box;
}

/* Custom scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #0f1013;
}

::-webkit-scrollbar-thumb {
    background: rgba(201,168,106,0.35);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(201,168,106,0.5);
}

/* ============================================================
   GRID SYSTEM
============================================================ */
.wr-grid {
    display: grid;
    gap: 16px;
}

.wr-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.wr-grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 10px;
}

.wr-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

/* ============================================================
   TYPOGRAPHY
============================================================ */
.wr-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--wr-accent);
    margin-bottom: 6px;
}

.wr-text-soft {
    color: var(--wr-text-soft);
}

.wr-text-accent {
    color: var(--wr-accent);
}

.wr-stat-value {
    font-size: 1.3rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

/* ============================================================
   PANEL SYSTEM
============================================================ */
.wr-panel {
    background: var(--wr-bg-panel);
    border: 1px solid var(--wr-border);
    border-radius: 8px;
    padding: 0;
    color: var(--wr-text-main);
}

.wr-panel-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--wr-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wr-panel-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--wr-accent);
}

/* ============================================================
   MST HEADER — Persistent command bar
============================================================ */
.mst-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 20px;
    background: rgba(0,0,0,0.4);
    border-bottom: 1px solid var(--wr-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    position: relative;
}

/* Brand / Logo */
.mst-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.mst-logo {
    width: 340px;
    height: 28px;
}
.mst-header-logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

/* Commander identity */
.mst-header-commander {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    padding-left: 16px;
    border-left: 1px solid var(--wr-border);
}
.mst-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 1px solid var(--wr-border-soft);
    object-fit: cover;
    filter: blur(0.4px) contrast(1.1) brightness(1.05);
}
.mst-header-identity {
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
}
.mst-header-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--wr-accent);
}
.mst-header-faction {
    font-size: 0.7rem;
    font-weight: 600;
}

/* Credits */
.mst-header-stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--wr-text-muted);
    flex-shrink: 0;
}
.mst-header-credits {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 16px;
    border-left: 1px solid var(--wr-border);
}
.mst-header-credits-val {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--wr-accent);
    white-space: nowrap;
}

/* Right meta: tick + galaxy + logout */
.mst-header-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    padding-left: 16px;
    border-left: 1px solid var(--wr-border);
}
.mst-header-tick {
    display: flex;
    align-items: center;
    gap: 6px;
}
.mst-header-tick-num {
    font-size: 0.7rem;
    color: var(--wr-text-muted);
    font-variant-numeric: tabular-nums;
}
.mst-header-galaxy {
    font-size: 0.75rem;
    color: var(--wr-text-soft);
    white-space: nowrap;
}
.mst-header-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--wr-border-soft);
    background: transparent;
    color: var(--wr-text-muted);
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.2s ease;
}
.mst-header-logout:hover {
    border-color: #ff5555;
    color: #ff5555;
    background: rgba(255,85,85,0.1);
}

/* Service days */
.mst-header-service {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 16px;
    border-left: 1px solid var(--wr-border);
}
.mst-header-service-val {
    font-size: 0.8rem;
    color: var(--wr-text-soft);
    white-space: nowrap;
}

/* Messages / Comms */
.mst-header-comms {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-left: 16px;
    border-left: 1px solid var(--wr-border);
    margin-right: auto;
}
.mst-header-comms-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #ff5555;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
}
.mst-header-comms-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--wr-border-soft);
    background: transparent;
    color: var(--wr-text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.mst-header-comms-btn:hover {
    border-color: var(--wr-accent);
    color: var(--wr-accent);
    background: rgba(212,175,55,0.1);
}

/* ---- Notification Bell Badge ---- */
.mst-header-notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #e74c3c;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    z-index: 10;
    pointer-events: none;
}

/* ---- Notification Dropdown ---- */
.notif-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 340px;
    max-height: 480px;
    overflow-y: auto;
    background: var(--wr-bg-dark, #0a0e14);
    border: 1px solid var(--wr-border, #1a2332);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    z-index: 1000;
    font-size: 13px;
}
.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--wr-border, #1a2332);
}
.notif-header-title {
    font-weight: 700;
    color: var(--wr-text-primary, #e0e0e0);
    font-size: 13px;
}
.notif-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #e74c3c;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    margin-left: 6px;
}
.notif-mark-all {
    background: none;
    border: none;
    color: var(--wr-accent, #d4af37);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
}
.notif-mark-all:hover {
    text-decoration: underline;
}
.notif-category-header {
    padding: 6px 12px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--wr-text-secondary, #8899aa);
    border-top: 1px solid var(--wr-border, #1a2332);
}
.notif-category-header:first-of-type {
    border-top: none;
}
.notif-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.15s;
}
.notif-item:hover {
    background: rgba(212,175,55,0.05);
}
.notif-item--read {
    opacity: 0.5;
}
.notif-item-title {
    color: var(--wr-text-primary, #e0e0e0);
    font-weight: 600;
    font-size: 12px;
    line-height: 1.3;
}
.notif-item-body {
    color: var(--wr-text-secondary, #8899aa);
    font-size: 11px;
    line-height: 1.3;
    margin-top: 2px;
    white-space: pre-line;
    max-height: 40px;
    overflow: hidden;
}
.notif-item-time {
    color: var(--wr-text-secondary, #8899aa);
    font-size: 10px;
    margin-top: 2px;
    text-align: right;
}
.notif-empty {
    padding: 24px 12px;
    text-align: center;
    color: var(--wr-text-secondary, #8899aa);
    font-size: 12px;
}
.notif-show-more {
    padding: 8px 12px;
    text-align: center;
    border-top: 1px solid var(--wr-border, #1a2332);
}
.notif-show-more-btn {
    background: none;
    border: none;
    color: var(--wr-accent, #d4af37);
    cursor: pointer;
    font-size: 12px;
}
.notif-show-more-btn:hover {
    text-decoration: underline;
}

/* Notification dropdown scrollbar */
.notif-dropdown::-webkit-scrollbar {
    width: 4px;
}
.notif-dropdown::-webkit-scrollbar-thumb {
    background: var(--wr-border, #1a2332);
    border-radius: 2px;
}

/* Mobile: stack header into two rows */
@media (max-width: 768px) {
    .mst-header {
        flex-wrap: wrap;
        gap: 10px;
        padding: 8px 12px;
    }
    .mst-header-brand { display: none; }
    .mst-header-commander { border-left: none; padding-left: 0; }
    .mst-header-credits { border-left: none; padding-left: 0; }
    .mst-header-service { border-left: none; padding-left: 0; }
    .mst-header-comms { border-left: none; padding-left: 0; margin-right: 0; }
    .mst-header-store { padding: 4px 10px; font-size: 0.7rem; }
    .mst-header-meta { margin-left: auto; border-left: none; padding-left: 0; }
    .notif-dropdown {
        position: fixed;
        top: auto;
        right: 8px;
        left: 8px;
        width: auto;
        max-height: 60vh;
    }
}

.wr-panel-content {
    padding: 16px;
}

.wr-panel-detail {
    margin-top: 20px;
}

.wr-panel-fleet {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Map panel specific */
.wr-panel-map .wr-panel-body {
    height: calc(100vh - 140px);
    min-height: 600px;
    position: relative;
}

/* Shipyard/system panel */
.shipssystem-panel {
    padding: 20px;
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
    /* Merged from duplicate sections - ensures full width */
    width: 100%;
    max-width: 100%;
    grid-column: 1 / -1; /* Span all columns in grid */
}


/* ============================================================
   CARD COMPONENT
============================================================ */
.card {
    position: relative;
    background: #1a1d24;
    border-radius: 10px;
    border: 1px solid rgba(201,168,106,0.35);
    box-shadow: 0 12px 24px rgba(0,0,0,0.55);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top left,
        rgba(74,163,255,0.12),
        transparent 60%);
    opacity: 0.7;
    pointer-events: none;
}

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

.card-title {
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--wr-text-main);
}

.card-tag {
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    border: 1px solid rgba(201,168,106,0.5);
    background: rgba(201,168,106,0.12);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.65rem;
    color: var(--wr-accent);
}

.card-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 0.4rem 0 0.6rem;
    padding: 0.3rem 0;
}

.card-value {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--wr-text-main);
    letter-spacing: 0.04em;
}

.card-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--wr-accent);
    opacity: 0.85;
    margin-top: 2px;
}

.wr-card-tight {
    padding: 0.75rem 0.9rem;
    gap: 0.3rem;
}

/* ============================================================
   BLOCK SYSTEM
============================================================ */
.wr-block {
    background: var(--wr-bg-panel);
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.wr-block-header {
    margin-bottom: 10px;
}

.wr-block-body {
    color: var(--wr-text-main);
    line-height: 1.45;
}

/* ============================================================
   EXPANDO PANEL
============================================================ */
.wr-expando {
    padding: 18px 20px 22px;
    border-radius: 14px;
    background:
        radial-gradient(circle at top left, rgba(74,163,255,0.12), transparent 60%),
        linear-gradient(to bottom, #25272c, #181a1f);
    border: 1px solid rgba(201,168,106,0.35);
    box-shadow:
        0 0 18px rgba(0,0,0,0.55),
        inset 0 0 12px rgba(74,163,255,0.08);
    animation: expando-fade 0.25s ease-out;
}

@keyframes expando-fade {
    0% { opacity: 0; transform: translateY(-6px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   LIST SYSTEM
============================================================ */
.wr-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    background: var(--wr-bg-panel);
    overflow: hidden;
}

.wr-list-item {
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(201,168,106,0.15);
    cursor: pointer;
    color: var(--wr-text-main);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.wr-list-item:last-child {
    border-bottom: none;
}

.wr-list-item:hover {
    background: var(--wr-accent-hover);
}

.wr-list-item.active {
    background: var(--wr-accent-strong);
    border-left: 3px solid var(--wr-border-strong);
}

.wr-list-empty {
    padding: 14px;
    text-align: center;
    color: var(--wr-text-soft);
    font-style: italic;
}

.wr-list-primary {
    font-size: 15px;
    font-weight: 500;
}

/* ============================================================
   TABLE SYSTEM
============================================================ */
.wr-table-wrapper {
    margin-top: 8px;
}

.wr-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--wr-bg-panel);
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    overflow: hidden;
}

.wr-table th {
    text-align: left;
    padding: 10px 12px;
    background: var(--wr-accent-soft);
    color: var(--wr-text-main);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wr-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(201,168,106,0.15);
    color: var(--wr-text-main);
}

.wr-table tr:last-child td {
    border-bottom: none;
}

.wr-table tr:hover {
    background: var(--wr-accent-hover);
    cursor: pointer;
}

.wr-table tr.active {
    background: var(--wr-accent-strong);
}

/* ============================================================
   TAB SYSTEM (Unified)
============================================================ */
.wr-tab-strip {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.wr-tab {
    padding: 6px 14px;
    background: var(--wr-bg-panel-alt);
    border: 1px solid var(--wr-border-soft);
    border-radius: 4px;
    color: var(--wr-text-main);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.wr-tab:hover {
    background: var(--wr-accent-hover);
    border-color: var(--wr-border-soft);
}

.wr-tab.active {
    background: var(--wr-accent-strong);
    border-color: var(--wr-border-strong);
    color: var(--wr-accent);
}

/* Tab content panels */
.shipyard-tab,
.shipssystem-tab,
.fleet-tab {
    display: none;
}

.shipyard-tab.active,
.shipssystem-tab.active,
.fleet-tab.active {
    display: block;
}

/* Ship system tabs */
.shipssystem-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.shipssystem-tab-button {
    background: #1f1f1f;
    border: 1px solid #333;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    color: #ccc;
    transition: 0.2s;
}

.shipssystem-tab-button:hover {
    background: #2a2a2a;
}

.shipssystem-tab-button.active {
    background: #3a3a3a;
    border-color: #555;
    color: #fff;
}

/* Fleet tabs */
.fleet-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

/* ============================================================
   BUTTON SYSTEM
============================================================ */
.wr-btn {
    background: var(--wr-bg-panel-alt);
    border: 1px solid var(--wr-border-soft);
    padding: 6px 12px;
    border-radius: 4px;
    color: var(--wr-text-main);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.wr-btn:hover {
    background: var(--wr-accent-hover);
    border-color: var(--wr-border-soft);
}

.wr-btn-primary {
    background: rgba(201,168,106,0.25);
    border-color: var(--wr-border-strong);
    color: var(--wr-accent);
}

.wr-btn-primary:hover {
    background: rgba(201,168,106,0.35);
}

/* Ship system button variant */
.shipssystem-button {
    background: #2d2d2d;
    border: 1px solid #444;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    color: #ddd;
    margin-right: 8px;
    margin-top: 10px;
    transition: 0.2s;
}

.shipssystem-button:hover {
    background: #3a3a3a;
    border-color: #666;
    color: #fff;
}

/* ============================================================
   TAG SYSTEM
============================================================ */
.wr-tag {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    display: inline-block;
}

.wr-tag-warning {
    background: var(--wr-accent-soft);
    color: var(--wr-accent);
}

.wr-tag-error {
    background: rgba(178,34,34,0.25);
    color: #ff6b6b;
}

/* ============================================================
   NAVIGATION STRIP
============================================================ */
.wr-nav-strip {
    display: flex;
    gap: 14px;
    padding: 14px 20px;
    background: rgba(20,20,25,0.85);
    border-bottom: 1px solid var(--wr-border);
    margin-bottom: 10px;
    box-shadow: 0 0 12px rgba(0,0,0,0.5);
}

.wr-nav-button {
    background: var(--wr-bg-panel-alt);
    border: 1px solid var(--wr-border-soft);
    padding: 8px 14px;
    border-radius: 6px;
    color: var(--wr-text-main);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.wr-nav-button:hover {
    background: var(--wr-accent-hover);
    border-color: var(--wr-border-soft);
}

.wr-nav-button.active {
    background: var(--wr-accent-strong);
    border-color: var(--wr-border-strong);
    color: var(--wr-accent);
}

/* Nav hamburger — hidden on desktop */
.wr-nav-hamburger {
    display: none;
    background: transparent;
    border: 1px solid var(--wr-border-soft);
    border-radius: 5px;
    padding: 6px 8px;
    color: var(--wr-text-soft);
    cursor: pointer;
    margin-right: 8px;
    flex-shrink: 0;
}
.wr-nav-hamburger:hover { color: var(--wr-text-main); border-color: var(--wr-accent); }

.wr-nav-menu {
    display: flex;
    gap: 14px;
    align-items: center;
}

.wr-nav-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 14px;
    border-left: 1px solid rgba(255,255,255,0.08);
    padding-left: 12px;
}

@media (max-width: 767px) {
    .wr-nav-hamburger { display: inline-flex; order: 1; }
    .wr-nav-strip { flex-wrap: wrap; gap: 0; }
    .wr-nav-meta { margin-left: auto; border-left: none; padding-left: 0; order: 2; }
    .wr-nav-menu {
        display: none;
        order: 3;
        flex-basis: 100%;
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 0 2px;
        margin-top: 8px;
        border-top: 1px solid rgba(255,255,255,0.08);
    }
    .wr-nav-menu.nav-menu-open { display: flex; }
    .wr-nav-menu .wr-nav-button { font-size: 0.75rem; padding: 7px 12px; }
}

.wr-nav-icon-btn {
    background: transparent;
    border: 1px solid transparent;
    padding: 6px 8px;
    border-radius: 5px;
    color: var(--wr-text-soft);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.85rem;
    position: relative;
}
.wr-nav-icon-btn:hover {
    background: var(--wr-accent-hover);
    color: var(--wr-text-main);
    border-color: var(--wr-border-soft);
}

/* ============================================================
   FORM ELEMENTS
============================================================ */
.wr-input,
.wr-select,
.wr-textarea,
.crud-input,
.crud-select {
    background: var(--wr-bg-panel);
    border: 1px solid var(--wr-border-soft);
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--wr-text-main);
    width: 100%;
}

/* Native <select> elements don't alpha-composite rgba backgrounds against the
   page backdrop the way divs do — they render their own opaque surface.
   Override with a solid dark colour so the dropdown matches the panel theme. */
select.wr-select,
select.crud-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: #1a1c22;
}

.wr-input:focus,
.wr-select:focus,
.wr-textarea:focus,
.crud-input:focus,
.crud-select:focus {
    outline: none;
    border-color: var(--wr-border-strong);
}

.wr-textarea {
    resize: vertical;
    min-height: 80px;
}

/* CRUD form specific */
.crud-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.crud-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.crud-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--wr-accent);
}

.crud-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

/* ============================================================
   ALERTS
============================================================ */
.wr-alert {
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.wr-alert-error {
    background: rgba(178,34,34,0.15);
    border: 1px solid rgba(178,34,34,0.4);
    color: #ff6b6b;
}

/* ============================================================
   PLANET SYSTEM
============================================================ */
.system-planet-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.planet-dot,
.solar-system-map .planet {
    display: inline-block;
    border-radius: 50%;
}

.planet-dot {
    width: 14px;
    height: 14px;
}

.solar-system-map .planet {
    width: 18px;
    height: 18px;
}

/* Planet classification colors */
.class-m { background: var(--planet-m); box-shadow: 0 0 8px var(--planet-m); }
.class-l { background: var(--planet-l); box-shadow: 0 0 8px var(--planet-l); }
.class-k { background: var(--planet-k); box-shadow: 0 0 8px var(--planet-k); }
.class-h { background: var(--planet-h); box-shadow: 0 0 8px var(--planet-h); }
.class-d { background: var(--planet-d); box-shadow: 0 0 8px var(--planet-d); }
.class-j { background: var(--planet-j); box-shadow: 0 0 8px var(--planet-j); }
.class-t { background: var(--planet-t); box-shadow: 0 0 8px var(--planet-t); }
.class-p { background: var(--planet-p); box-shadow: 0 0 8px var(--planet-p); }
.class-o { background: var(--planet-o); box-shadow: 0 0 8px var(--planet-o); }
.class-n { background: var(--planet-n); box-shadow: 0 0 8px var(--planet-n); }
.class-y { background: var(--planet-y); box-shadow: 0 0 8px var(--planet-y); }
.class-r { background: var(--planet-r); box-shadow: 0 0 8px var(--planet-r); }

/* ============================================================
   SOLAR SYSTEM MAP
============================================================ */
.solar-system-map {
    position: relative;
    width: 420px;
    height: 420px;
    margin: 0 auto;
}

.solar-system-map .star {
    width: 26px;
    height: 26px;
    background: radial-gradient(circle, #ffd27f, #ff9f1c);
    border-radius: 50%;
    box-shadow: 0 0 18px rgba(255,200,120,0.8);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px dashed rgba(201,168,106,0.25);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.orbit .planet {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: center;
}

/* ============================================================
   GALAXY MAP
============================================================ */
.galaxy-map-container {
    width: 100%;
    height: 700px;
    position: relative;
}

#galaxy-canvas,
#galaxy-map-canvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 10px;
}

.galaxy-popup {
    position: absolute;
    background: rgba(20,20,25,0.9);
    border: 1px solid rgba(201,168,106,0.4);
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--wr-text-main);
    box-shadow: 0 0 12px rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 20;
}

.galaxy-popup .popup-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--wr-arcane);
}

.galaxy-popup .popup-coords {
    font-size: 12px;
    color: var(--wr-text-muted);
    margin-bottom: 8px;
}

.galaxy-popup .popup-button {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(74,163,255,0.15);
    border: 1px solid rgba(74,163,255,0.4);
    color: var(--wr-text-main);
    font-size: 12px;
    text-decoration: none;
}

.galaxy-popup .popup-button:hover {
    background: rgba(74,163,255,0.25);
    border-color: var(--wr-arcane);
}

/* Map layout — canvas + sidebar, no overlap */
.wr-map-layout {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    gap: 0;
}

.wr-map-canvas {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    position: relative;
}

.wr-map-canvas canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.wr-map-detail {
    flex: 0 0 220px;
    width: 220px;
    height: 100%;
    background: rgba(14, 14, 22, 0.98);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px 14px;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
}

.wr-map-detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.wr-map-detail-row:last-child {
    margin-bottom: 0;
}

.wr-map-detail .wr-label {
    opacity: 0.6;
    font-size: 12px;
}

.wr-map-detail .wr-value {
    font-size: 13px;
    font-weight: 500;
}

.wr-map-detail-actions {
    margin-top: 12px;
    text-align: right;
}

/* -------------------- MAP MOBILE BREAKPOINT -------------------- */
@media (max-width: 768px) {
    .wr-map-layout {
        flex-direction: column;
    }
    .wr-map-canvas {
        height: 70vh;
        min-height: 280px;
    }
    .wr-map-detail {
        flex: 0 0 auto;
        width: 100%;
        height: auto;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
}

/* ============================================================
   CREW PANEL
============================================================ */
.wr-crew-row {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
}
.wr-crew-row-main {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}
.wr-crew-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--wr-text-main);
}
.wr-crew-role {
    font-size: 12px;
    color: var(--wr-text-muted, rgba(255,255,255,0.5));
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.wr-crew-rarity {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
}
.wr-rarity-common    { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6); }
.wr-rarity-uncommon  { background: rgba(80,200,100,0.2);  color: #6ecf80; }
.wr-rarity-rare      { background: rgba(80,140,255,0.2);  color: #7eb0ff; }
.wr-rarity-elite     { background: rgba(180,80,255,0.2);  color: #c97dff; }
.wr-rarity-legendary { background: rgba(255,180,40,0.25); color: #ffc840; }
.wr-crew-row-stats {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 4px;
}
.wr-crew-row-location {
    font-size: 12px;
    color: rgba(255,255,255,0.45);
    margin-bottom: 4px;
}
.wr-crew-ship-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
}
.wr-crew-ship-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.wr-crew-capacity {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255,255,255,0.5);
}
.wr-crew-roster-entry {
    font-size: 12px;
    padding: 2px 0;
    color: rgba(255,255,255,0.7);
}
.wr-crew-roster-entry em {
    color: rgba(255,255,255,0.4);
    font-style: normal;
    font-size: 11px;
}
.wr-muted { color: rgba(255,255,255,0.45); }
.wr-btn-sm {
    padding: 3px 10px;
    font-size: 12px;
}
.wr-btn-danger {
    color: #ef4444;
    border-color: rgba(239,68,68,0.3);
}
.wr-btn-danger:hover {
    background: rgba(239,68,68,0.15);
}
.roster-subtabs {
    display: flex;
    gap: 6px;
    padding: 0 0 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 10px;
}
.roster-subtab {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.5);
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
}
.roster-subtab.active {
    background: rgba(80,180,255,0.15);
    border-color: rgba(80,180,255,0.4);
    color: #7ec8ff;
}
.wr-select {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    color: #fff;
    padding: 4px 8px;
    font-size: 12px;
}

/* ============================================================
   FLEET MANAGEMENT
============================================================ */
.fleet-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Fleet ship selector (dropdown replacing old list column) */
.fleet-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.fleet-ship-dropdown {
    flex: 1;
    max-width: 500px;
    padding: 10px 14px;
    background: var(--wr-bg-card, #1a1a2e);
    color: var(--wr-text, #e0e0e0);
    border: 1px solid var(--wr-border-soft, rgba(255,255,255,0.1));
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}
.fleet-ship-dropdown:focus {
    outline: none;
    border-color: var(--wr-accent, #4fd1ff);
}

.fleet-count {
    color: var(--wr-text-soft, #aaa);
    font-size: 0.85rem;
    white-space: nowrap;
}

.fleet-placeholder {
    opacity: 0.6;
    font-size: 0.9rem;
    padding: 8px 4px;
}

.fleet-crew-entry {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
}

.fleet-crew-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.fleet-crew-role {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--wr-text-muted, #888);
    margin-bottom: 2px;
}

.fleet-crew-stats {
    font-size: 0.78rem;
    display: flex;
    gap: 8px;
    color: var(--wr-text-soft, #aaa);
    margin: 4px 0;
}

.fleet-crew-stats span {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.fleet-crew-actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.fleet-crew-note {
    font-size: 0.72rem;
    color: var(--wr-text-muted, #888);
    font-style: italic;
    margin-top: 4px;
}

/* Fleet details overview (image + info side-by-side) */
.fleet-details-overview {
    display: flex;
    gap: 14px;
    margin: 8px 0;
}
.fleet-details-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    font-size: 0.85rem;
}
.fleet-info-line {
    color: var(--wr-text-soft, #aaa);
}
.fleet-info-line strong {
    color: var(--wr-text, #e0e0e0);
}

/* Fleet details bars (hull/fuel/integrity in center column) */
.fleet-details-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0;
}
.fleet-details-bars .bar-row {
    display: grid;
    grid-template-columns: 70px 1fr 40px;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
}
.fleet-details-bars .bar-pct {
    text-align: right;
    font-size: 0.78rem;
    color: var(--wr-text-soft, #aaa);
}

/* Hull integrity bar */
.integrity-bar .holo-bar-fill {
    background: linear-gradient(90deg, #4aa8d8, #6ec6f0);
}

/* Integrity colour states */
.integrity-low {
    color: #ffaa00;
}
.integrity-critical {
    color: #ff4444;
}
.integrity-low .holo-bar-fill,
.holo-bar-fill.integrity-low {
    background: linear-gradient(90deg, #cc7700, #ffaa00) !important;
}
.integrity-critical .holo-bar-fill,
.holo-bar-fill.integrity-critical {
    background: linear-gradient(90deg, #aa1111, #ff4444) !important;
}

.fleet-details,
.fleet-context {
    min-height: 220px;
}

/* Destroyed ship states */
.ship-destroyed {
    opacity: 0.5;
    filter: grayscale(0.6);
}
.ship-destroyed-badge {
    color: #ff4444;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .05em;
}

/* Insurance UI */
.fleet-insurance-row {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.07);
}
.insurance-badge {
    color: #34d399;
    font-size: .78rem;
    font-weight: 600;
}

/* ============================================================
   SHIPYARD & SHIP SYSTEMS
============================================================ */
.wr-ship-image {
    width: 260px;
    height: 170px;
    object-fit: contain;
    object-position: center;
    border-radius: 8px;
    box-shadow: 0 0 12px rgba(74,163,255,0.35);
}

/* ── Shipyard Buy Tab Cards ───────────────────────── */
.sy-buy-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.sy-ship-card {
    display: flex;
    gap: 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    overflow: hidden;
}
.sy-card-image {
    width: 160px;
    min-width: 160px;
    height: 120px;
    object-fit: cover;
    object-position: center;
}
.sy-card-body {
    flex: 1;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sy-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #e0e8ff;
}
.sy-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px 10px;
}
.sy-stat-item {
    display: flex;
    flex-direction: column;
}
.sy-stat-label {
    font-size: 9px;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sy-stat-value {
    font-size: 12px;
    color: #c8d8ff;
    font-weight: 500;
}
.sy-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.sy-slot-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 3px;
    letter-spacing: 0.03em;
}
.sy-slot-weapon  { background: rgba(239,68,68,0.18);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.35); }
.sy-slot-engine  { background: rgba(59,130,246,0.18); color: #93c5fd; border: 1px solid rgba(59,130,246,0.35); }
.sy-slot-cargo   { background: rgba(34,197,94,0.15);  color: #86efac; border: 1px solid rgba(34,197,94,0.3); }
.sy-slot-defense { background: rgba(251,146,60,0.18); color: #fdba74; border: 1px solid rgba(251,146,60,0.35); }
.sy-slot-utility { background: rgba(168,85,247,0.18); color: #d8b4fe; border: 1px solid rgba(168,85,247,0.35); }
.sy-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}
.sy-card-price {
    font-size: 14px;
    font-weight: 700;
    color: #4ade80;
}
.sy-price-unaffordable {
    color: #f87171;
}

.shipssystem-upgrade-card {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 0 8px rgba(0,0,0,0.4);
}

.shipssystem-upgrade-card.is-owned {
    opacity: 0.6;
}

.shipssystem-upgrade-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.shipssystem-upgrade-desc {
    font-size: 0.78rem;
    color: var(--wr-text-soft, #aaa);
    margin-bottom: 6px;
}

.shipssystem-upgrade-stats {
    font-size: 0.78rem;
    color: #4ec9b0;
    margin-bottom: 8px;
}

.shipssystem-upgrade-cost {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--wr-accent, #c9a86a);
    margin-bottom: 6px;
}

.shipssystem-slot-header {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--wr-text-muted, #888);
    margin-bottom: 4px;
}
.sy-size-badge {
    display: inline-block;
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sy-size-medium { background: rgba(255,180,0,0.15); color: #f0a500; border: 1px solid rgba(255,180,0,0.3); }
.sy-size-large  { background: rgba(220,60,60,0.15);  color: #e05555; border: 1px solid rgba(220,60,60,0.3); }

.shipssystem-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #4ec9b0;
    margin: 0 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(78,201,176,0.25);
}

.shipssystem-badge-owned {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #4ec9b0;
    border: 1px solid #4ec9b0;
    border-radius: 3px;
    padding: 1px 5px;
    margin-left: 6px;
    vertical-align: middle;
}

.shipssystem-upgrade-card .crew-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #fff;
}

/* ============================================================
   TICK TIMER
============================================================ */
.wr-tick-timer {
    position: relative;
    width: 32px;
    height: 32px;
    margin-left: 12px;
}

.wr-tick-timer svg {
    width: 32px;
    height: 32px;
    transform: rotate(-90deg);
}

.wr-tick-timer circle {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
}

.wr-tick-timer .bg {
    stroke: #444;
    opacity: 0.4;
}

.wr-tick-timer .fg {
    stroke: #4ec9a8;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.5s linear;
}

.wr-tick-timer .wr-tick-label {
    position: absolute;
    top: 0;
    left: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #ddd;
}

/* Simplified commander status card (header holds identity/vitals now) */
.commander-status-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0;
}
.commander-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.commander-status-label {
    font-size: 0.8rem;
    color: var(--wr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex-shrink: 0;
    min-width: 90px;
}
.commander-status-val {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--wr-text-main);
    text-align: right;
}

/* ============================================================
   MODAL SYSTEM
============================================================ */
.wr-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

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

.wr-modal-inner {
    background: #050814;
    border-radius: 6px;
    padding: 16px 18px;
    min-width: 260px;
    max-width: 360px;
    border: 1px solid rgba(255,255,255,0.12);
}

.wr-modal-title {
    font-weight: 600;
    margin-bottom: 10px;
}

.wr-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

/* Salvage encounter modal */
.salvage-modal-desc {
    color: #aaa;
    font-size: .85rem;
    margin-bottom: 10px;
}
.salvage-goods-list {
    margin-bottom: 8px;
}
.salvage-goods-row {
    display: flex;
    justify-content: space-between;
    font-size: .85rem;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.salvage-goods-name { color: #c8d8e8; }
.salvage-goods-qty  { color: #7cb8e8; }
.salvage-modal-note {
    font-size: .8rem;
    color: #aaa;
    margin-top: 4px;
}

/* ============================================================
   UTILITY CLASSES
============================================================ */
.wr-flex {
    display: flex;
}

.wr-actions-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Spacing utilities */
.wr-mt-2 { margin-top: 8px; }
.wr-mt-3 { margin-top: 12px; }
.wr-mt-4 { margin-top: 16px; }

.wr-mb-2 { margin-bottom: 8px; }
.wr-mb-3 { margin-bottom: 12px; }

/* 
DASHBOARD LAYOUT & CONTAINER
============================================================ */
.panel-container {
    padding: 20px;
    max-width: 1800px;
    margin: 0 auto;
    display: grid;
    gap: 16px;
    align-items: start;
}

/* Reset grid to single column for non-home panels */
.panel-container--single {
    grid-template-columns: 1fr !important;
    grid-template-areas: none !important;
}

/* ============================================================
   CARD CORNER NODES
============================================================ */
.card-corner-node {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--wr-accent);
    opacity: 0.6;
    border-radius: 50%;
    box-shadow: 0 0 8px var(--wr-accent);
}

.card-corner-node.tl {
    top: -4px;
    left: -4px;
}

.card-corner-node.tr {
    top: -4px;
    right: -4px;
}

.card-corner-node.bl {
    bottom: -4px;
    left: -4px;
}

.card-corner-node.br {
    bottom: -4px;
    right: -4px;
}

/* ============================================================
   STARSHIP CARD
============================================================ */
.ship-hologram {
    flex-shrink: 0;
    width: 180px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--wr-border-soft);
    border-radius: 6px;
    overflow: hidden;
}

.ship-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(74,163,255,0.3));
}

.ship-image-missing {
    color: var(--wr-text-soft);
    font-size: 0.8rem;
    text-align: center;
}

.ship-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--wr-text-main);
    margin-bottom: 8px;
}

.ship-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bar-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--wr-text-soft);
    margin-bottom: 4px;
}

/* ============================================================
   HOLOGRAPHIC PROGRESS BARS
============================================================ */
.holo-bar {
    position: relative;
    width: 100%;
    height: 18px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--wr-border-soft);
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.5);
}

.holo-bar-fill {
    height: 100%;
    transition: width 0.3s ease;
    position: relative;
    border-radius: 2px;
}

/* Bar color variants */
.hull-bar .holo-bar-fill {
    background: linear-gradient(90deg, #4a9d5f, #5fbf7a);
    box-shadow: 0 0 10px rgba(74,157,95,0.6);
}

.fuel-bar .holo-bar-fill {
    background: linear-gradient(90deg, #ffaa00, #ffcc66);
    box-shadow: 0 0 10px rgba(255,170,0,0.6);
}

/* Animated glow effect on bars */
.holo-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.3),
        transparent
    );
    animation: bar-shimmer 2s infinite;
}

@keyframes bar-shimmer {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* ============================================================
   CARGO CARD
============================================================ */
.cargo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.cargo-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.cargo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--wr-border-soft);
    border-radius: 4px;
}

.cargo-item-name {
    font-size: 0.9rem;
    color: var(--wr-text-main);
}

.cargo-item-qty {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--wr-accent);
}

.cargo-empty {
    text-align: center;
    padding: 20px;
    color: var(--wr-text-soft);
    font-style: italic;
}

/* ============================================================
   SYSTEM OVERVIEW CARD
============================================================ */
.system-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--wr-border-soft);
}

.system-traffic {
    font-size: 0.85rem;
    color: var(--wr-text-soft);
}

.location-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--wr-border-soft);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.location-entry:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--wr-border-strong);
}

.location-entry-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--wr-text-main);
}

.location-entry-type {
    font-size: 0.8rem;
    color: var(--wr-text-soft);
    text-transform: uppercase;
}

/* ============================================================
   BUTTONS
============================================================ */
.pr-button-flat {
    background: var(--wr-bg-panel-alt);
    border: 1px solid var(--wr-border-soft);
    padding: 10px 16px;
    border-radius: 6px;
    color: var(--wr-text-main);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.pr-button-flat:hover {
    background: var(--wr-accent-hover);
    border-color: var(--wr-border-strong);
    color: var(--wr-accent);
}

.pr-button-flat.primary {
    background: rgba(201,168,106,0.2);
    border-color: var(--wr-accent);
    color: var(--wr-accent);
}

.pr-button-flat.primary:hover {
    background: rgba(201,168,106,0.3);
}

.pr-button-flat.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Action button variants */
.pr-button-flat.action-dock {
    border-color: #4aa3ff;
    color: #4aa3ff;
}

.pr-button-flat.action-launch {
    border-color: #ff9f1c;
    color: #ff9f1c;
}

.pr-button-flat.action-land {
    border-color: #4a9d5f;
    color: #4a9d5f;
}

/* ============================================================
   TOOLTIP
============================================================ */
.tooltip-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.tooltip-wrapper[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: rgba(20,20,25,0.95);
    border: 1px solid var(--wr-border-strong);
    border-radius: 6px;
    color: var(--wr-text-main);
    font-size: 0.8rem;
    white-space: pre-line;
    z-index: 1000;
    pointer-events: none;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

/* ============================================================
   MERGED CARD STYLES - Starship+Cargo & Location+System
============================================================ */

/* ============================================================
   STARSHIP + CARGO MERGED CARD
============================================================ */
.starship-cargo-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.starship-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ship-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.ship-actions a.pr-button-flat {
    text-align: center;
}

/* RIFTco Emergency Fuel */
.riftco-btn {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
    animation: riftco-pulse 2s ease-in-out infinite;
}
.riftco-btn:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: #f87171 !important;
}
.riftco-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}
.riftco-note {
    font-size: 0.75rem;
    color: var(--wr-text-dim);
    font-style: italic;
}
@keyframes riftco-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Cargo Section */
.cargo-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cargo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--wr-border-soft);
}

.cargo-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--wr-accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.cargo-capacity-text {
    font-size: 0.85rem;
    color: var(--wr-text-soft);
}

.cargo-bar .holo-bar-fill {
    background: linear-gradient(90deg, #9a7fb8, #b894d4);
    box-shadow: 0 0 10px rgba(154,127,184,0.6);
}

.cargo-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

.cargo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--wr-border-soft);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.cargo-item:hover {
    background: rgba(255,255,255,0.04);
    border-color: var(--wr-border-strong);
}

.cargo-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cargo-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--wr-text-main);
}

.cargo-item-weight {
    font-size: 0.75rem;
    color: var(--wr-text-soft);
}

.cargo-item-qty {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--wr-accent);
    min-width: 80px;
    text-align: right;
}

.cargo-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--wr-text-soft);
    font-style: italic;
    font-size: 0.9rem;
}

.cargo-actions {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--wr-border-soft);
}

/* Responsive for starship+cargo internal layout */
@media (max-width: 900px) {
    .starship-cargo-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ============================================================
   LOCATION + SYSTEM OVERVIEW MERGED CARD
============================================================ */
.location-system-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Travel Status (when travelling) */
.travel-status {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 20px;
    background: rgba(255,170,0,0.08);
    border: 1px solid rgba(255,170,0,0.3);
    border-radius: 8px;
}

.travel-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.travel-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.travel-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--wr-text-main);
}

.travel-destination {
    font-size: 0.9rem;
    color: var(--wr-text-soft);
}

.travel-eta {
    font-size: 1rem;
    color: var(--wr-accent);
    font-weight: 500;
}

/* System Header */
.system-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--wr-border-soft);
}

.system-name-large {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--wr-text-main);
}

.system-meta {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--wr-text-soft);
}

.system-id,
.system-traffic {
    display: inline-block;
}

.system-actions-row {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

/* Location Sections (Planets/Stations) */
.location-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.location-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--wr-border-soft);
}

.location-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--wr-accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.location-section-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--wr-text-soft);
    background: rgba(255,255,255,0.05);
    padding: 4px 10px;
    border-radius: 12px;
}

.location-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.location-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--wr-border-soft);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.location-entry:hover {
    background: rgba(255,255,255,0.04);
    border-color: var(--wr-border-strong);
}

.location-entry-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wr-accent-soft);
    border-radius: 8px;
    font-size: 1.2rem;
}

.planet-icon .planet-dot {
    width: 24px;
    height: 24px;
}

.station-icon {
    color: var(--wr-arcane);
    font-size: 1.5rem;
}

.location-entry-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.location-entry-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--wr-text-main);
}

.location-entry-type {
    font-size: 0.8rem;
    color: var(--wr-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.location-entry-actions {
    display: flex;
    gap: 8px;
}

.location-status-text {
    font-size: 0.85rem;
    color: var(--wr-accent);
    font-weight: 500;
    padding: 8px 12px;
}

.location-empty,
.system-empty {
    text-align: center;
    padding: 30px 20px;
    color: var(--wr-text-soft);
    font-style: italic;
    font-size: 0.9rem;
}

/* ============================================================
   PLANET INFO CARD (shown when landed)
============================================================ */
.planet-info-content {
    padding: 16px 20px;
}
.planet-info-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.planet-info-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--wr-text-main);
}
.planet-info-class {
    font-size: 0.8rem;
    color: var(--wr-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.planet-info-stats {
    margin-bottom: 14px;
}
.planet-info-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.planet-info-stat-label {
    font-size: 0.8rem;
    color: var(--wr-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.planet-info-stat-value {
    font-size: 0.9rem;
    color: var(--wr-text-main);
    font-weight: 500;
}
.pop-trend { font-size: 0.75rem; margin-left: 4px; }
.pop-growing { color: #4caf50; }
.pop-declining { color: #ef4444; }
.pop-stable { color: #9e9e9e; }
.planet-info-export-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.planet-export-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
    border: 1px solid;
    border-radius: 4px;
    background: rgba(255,255,255,0.03);
}


/* ============================================================
   SHIP STATUS INDICATOR (in Starship card)
============================================================ */
.ship-status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--wr-border-soft);
    border-radius: 6px;
    margin-bottom: 8px;
}

.ship-status-label {
    font-size: 0.8rem;
    color: var(--wr-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ship-status-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--wr-accent);
}
.ship-temp-post-warning {
    font-size: 0.75rem;
    color: #ff9800;
    background: rgba(255,152,0,0.08);
    border: 1px solid rgba(255,152,0,0.2);
    border-radius: 4px;
    padding: 4px 8px;
    margin-top: 4px;
    text-align: center;
    animation: tp-pulse-amber 2s ease-in-out infinite;
}

/* Primary action button styling */
.pr-button-flat.primary {
    background: rgba(201,168,106,0.2);
    border-color: var(--wr-accent);
    color: var(--wr-accent);
    font-weight: 600;
}

.pr-button-flat.primary:hover {
    background: rgba(201,168,106,0.3);
    border-color: var(--wr-border-strong);
}

/* Unread badge (used by card_commander.php) */
.comms-unread-badge {
    background: #ff5555;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 0 8px rgba(255,85,85,0.5);
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% { 
        box-shadow: 0 0 8px rgba(255,85,85,0.5);
    }
    50% { 
        box-shadow: 0 0 16px rgba(255,85,85,0.8);
    }
}

/* ============================================================
   MISSIONS CARD - Action Tracker
============================================================ */
.mission-count-badge {
    display: inline-block;
    background: var(--wr-arcane);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 8px;
    box-shadow: 0 0 8px rgba(74,163,255,0.5);
}

.missions-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Empty State */
.missions-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
    text-align: center;
}

.missions-empty-icon {
    font-size: 3rem;
    opacity: 0.3;
}

.missions-empty-text {
    color: var(--wr-text-soft);
    font-style: italic;
}

/* Mission List */
.mission-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mission-entry {
    padding: 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--wr-border-soft);
    border-left: 3px solid var(--wr-arcane);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.2s ease;
}

.mission-entry:hover {
    background: rgba(255,255,255,0.04);
    border-left-color: var(--wr-accent);
}

.mission-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mission-icon {
    font-size: 1.2rem;
}

.mission-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--wr-text-main);
    flex: 1;
}

.mission-objective {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
    background: rgba(74,163,255,0.08);
    border-radius: 4px;
}

.objective-arrow {
    color: var(--wr-arcane);
    font-weight: bold;
    flex-shrink: 0;
}

.objective-text {
    font-size: 0.85rem;
    color: var(--wr-text-main);
    line-height: 1.4;
}

/* Mission Progress */
.mission-progress {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--wr-text-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.mission-progress-bar {
    height: 6px;
    background: rgba(0,0,0,0.3);
    border-radius: 3px;
    overflow: hidden;
}

.mission-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--wr-arcane), #7eb8ff);
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(74,163,255,0.6);
}

.mission-entry-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}

.mission-reward {
    font-size: 0.8rem;
    color: var(--wr-accent);
    font-weight: 500;
}

.mission-action-btn {
    font-size: 0.75rem;
    padding: 3px 10px;
    white-space: nowrap;
}

/* Missions Card — Tab Strip */
.missions-tab-strip {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--wr-border-soft);
    margin-bottom: 12px;
}

.missions-tab {
    flex: 1;
    padding: 8px 12px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--wr-text-soft);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.missions-tab:hover {
    color: var(--wr-text-main);
    background: rgba(255,255,255,0.02);
}

.missions-tab.active {
    color: var(--wr-accent);
    border-bottom-color: var(--wr-accent);
}

/* Missions Card — Available Mission Entries */
.mission-avail-entry {
    padding: 10px 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--wr-border-soft);
    border-left: 3px solid var(--wr-text-soft);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.2s ease;
}

.mission-avail-entry:hover {
    background: rgba(255,255,255,0.04);
    border-left-color: var(--wr-accent);
}

.mission-avail-entry.mission-locked {
    opacity: 0.55;
}

.mission-avail-faction {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.mission-faction-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mission-faction-name {
    font-weight: 500;
    font-size: 0.8rem;
}

/* Mini Sector Map (collapsible, inside missions card) */
.mini-map-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin-top: 8px;
    border-top: 1px solid var(--wr-border-soft);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--wr-text-soft);
    transition: color 0.2s ease;
    user-select: none;
}
.mini-map-toggle:hover {
    color: var(--wr-accent);
}
.mini-map-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}
.mini-map-wrap {
    padding: 0 12px 12px;
}
#dashboard-mini-map {
    width: 100%;
    height: 280px;
    border: 1px solid var(--wr-border-soft);
    border-radius: 6px;
    display: block;
}
.mini-map-hint {
    font-size: 0.7rem;
    color: var(--wr-text-soft);
    text-align: center;
    margin-top: 6px;
    opacity: 0.7;
}

/* Player Faction panel layout */
.pf-body-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}
.pf-right-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.pf-banner-top {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
}
.pf-banner-stats {
    text-align: right;
    font-size: 0.85rem;
    color: var(--wr-text-soft);
    flex-shrink: 0;
}

/* -------------------- FACTION MOBILE BREAKPOINT -------------------- */
@media (max-width: 768px) {
    .pf-body-grid {
        grid-template-columns: 1fr;
    }
    .pf-banner-top {
        flex-wrap: wrap;
    }
    .pf-banner-stats {
        flex-basis: 100%;
        text-align: left;
        display: flex;
        gap: 1rem;
        font-size: 0.8rem;
        margin-top: 0.25rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--wr-border);
    }
}

/* Guild Galaxy Standing */
.guild-standing-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--wr-border);
    font-size: 0.85rem;
}
.guild-standing-row:last-child {
    border-bottom: none;
}
.guild-standing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.guild-standing-name {
    flex: 1;
    min-width: 0;
    font-weight: 500;
    color: var(--wr-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.guild-standing-rep {
    font-weight: 600;
    font-size: 0.8rem;
    min-width: 3rem;
    text-align: right;
}
.guild-standing-tier {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    white-space: nowrap;
    min-width: 5.5rem;
    text-align: center;
}

/* Guild tribute buttons */
.guild-tribute-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0 0.5rem 1.2rem;
    flex-wrap: wrap;
}
.guild-tribute-btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border: 1px solid rgba(218, 165, 32, 0.5);
    border-radius: 4px;
    background: rgba(218, 165, 32, 0.1);
    color: #DAA520;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
}
.guild-tribute-btn:hover:not(:disabled) {
    background: rgba(218, 165, 32, 0.25);
    border-color: #DAA520;
}
.guild-tribute-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.guild-tribute-cooldown {
    font-size: 0.75rem;
    color: var(--wr-text-soft);
    font-style: italic;
}
.guild-tribute-pirate {
    font-size: 0.65rem;
    color: #CC0000;
    font-style: italic;
}

/* Guild trade agreements */
.guild-agreement-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0 0 0.5rem 1.2rem;
    flex-wrap: wrap;
}
.guild-agreement-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: rgba(39, 174, 96, 0.15);
    color: #27AE60;
    border: 1px solid rgba(39, 174, 96, 0.3);
}
.guild-agreement-cancel-btn {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border: 1px solid rgba(204, 68, 68, 0.5);
    border-radius: 3px;
    background: transparent;
    color: #cc4444;
    cursor: pointer;
}
.guild-agreement-cancel-btn:hover {
    background: rgba(204, 68, 68, 0.15);
}
.guild-agreement-propose-btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border: 1px solid rgba(39, 174, 96, 0.5);
    border-radius: 4px;
    background: rgba(39, 174, 96, 0.1);
    color: #27AE60;
    cursor: pointer;
    font-weight: 600;
}
.guild-agreement-propose-btn:hover:not(:disabled) {
    background: rgba(39, 174, 96, 0.25);
    border-color: #27AE60;
}
.guild-agreement-propose-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Guild faction contracts */
.guild-contract-card {
    padding: 0.75rem;
    background: rgba(0, 180, 216, 0.05);
    border: 1px solid rgba(0, 180, 216, 0.2);
    border-radius: 6px;
}
.guild-contract-request-btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border: 1px solid rgba(0, 180, 216, 0.5);
    border-radius: 4px;
    background: rgba(0, 180, 216, 0.1);
    color: #00b4d8;
    cursor: pointer;
    font-weight: 600;
}
.guild-contract-request-btn:hover {
    background: rgba(0, 180, 216, 0.25);
    border-color: #00b4d8;
}

/* Territorial tax badges */
.territory-tax-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    margin-left: 0.35rem;
    background: rgba(230, 126, 34, 0.15);
    color: #E67E22;
    border: 1px solid rgba(230, 126, 34, 0.3);
    white-space: nowrap;
}
.territory-tax-badge.territory-tax-free {
    background: rgba(46, 204, 113, 0.15);
    color: #2ECC71;
    border-color: rgba(46, 204, 113, 0.3);
}
.territory-tax-summary {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--wr-border);
    font-size: 0.85rem;
}

/* ── Siege badges + integrity bar ─────────────────────────── */
.territory-siege-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    margin-left: 0.35rem;
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.4);
    white-space: nowrap;
    animation: siege-pulse 2s ease-in-out infinite;
}
.territory-siege-warning {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    margin-left: 0.35rem;
    background: rgba(243, 156, 18, 0.2);
    color: #f39c12;
    border: 1px solid rgba(243, 156, 18, 0.4);
    white-space: nowrap;
}
@keyframes siege-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.territory-integrity-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    margin-top: 0.25rem;
    overflow: hidden;
    position: relative;
}
.territory-integrity-fill {
    height: 100%;
    background: #2ecc71;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.territory-integrity-fill.low { background: #f39c12; }
.territory-integrity-fill.critical { background: #e74c3c; }
.territory-integrity-label {
    position: absolute;
    right: 4px;
    top: -1px;
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--wr-text-main);
    text-shadow: 0 0 2px rgba(0,0,0,0.8);
}

/* ── Siege panel in events ──────────────────────────────── */
.events-siege-panel {
    background: rgba(255, 107, 53, 0.08);
    border: 1px solid rgba(255, 107, 53, 0.25);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    margin: 0.5rem 0;
}

/* ── Market siege banner ────────────────────────────────── */
.market-siege-banner {
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.4);
    color: #e74c3c;
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
}

.mission-dest {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.mission-dest-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.mission-dest-badge.distance-near {
    background: rgba(34,197,94,0.15);
    color: #22c55e;
    border: 1px solid rgba(34,197,94,0.3);
}

.mission-dest-badge.distance-mid {
    background: rgba(245,158,11,0.15);
    color: #f59e0b;
    border: 1px solid rgba(245,158,11,0.3);
}

.mission-dest-badge.distance-far {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.3);
}

.mission-dest-name {
    color: var(--wr-text-soft);
}

.mission-rep-reward {
    font-size: 0.75rem;
    color: #a78bfa;
}

.mission-lock-msg {
    font-size: 0.75rem;
    color: #ef4444;
    opacity: 0.8;
}

.mission-accept-btn {
    padding: 3px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(201,168,106,0.15);
    border: 1px solid rgba(201,168,106,0.4);
    border-radius: 4px;
    color: var(--wr-accent);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.mission-accept-btn:hover {
    background: rgba(201,168,106,0.25);
    border-color: var(--wr-accent);
}


/* ============================================================
   ACTIVITY LOG SYSTEM
   Styles for player activity log panel and dashboard preview
============================================================ */

/* -------------------- LOG FILTERS -------------------- */
.log-filters {
    width: 100%;
    max-width: 100%;
    background: var(--wr-bg-panel);
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-select {
    flex: 1;
    min-width: 180px;
    padding: 8px 12px;
    background: var(--wr-bg-panel-alt);
    border: 1px solid var(--wr-border-soft);
    border-radius: 4px;
    color: var(--wr-text-main);
    font-family: 'Segoe UI', sans-serif;
    transition: border-color 0.15s ease;
    /* Merged dark theme fix */
    background: var(--wr-bg-panel) !important;
    color: var(--wr-text-main) !important;
}

.filter-select:focus {
    outline: none;
    border-color: var(--wr-border-strong);
}

/* -------------------- LOG ENTRIES -------------------- */
.log-entries {
    width: 100%;
    max-width: 100%;
    max-height: 600px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.log-entry {
    width: 100%;
    max-width: none;
    background: var(--wr-bg-panel);
    border-left: 3px solid var(--wr-border);
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.log-entry:hover {
    background: var(--wr-accent-hover);
    border-left-color: var(--wr-accent);
    border-color: var(--wr-border-soft);
}

.log-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.log-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.log-action {
    color: var(--wr-accent);
    font-weight: 600;
    flex: 1;
    text-transform: capitalize;
}

.log-time {
    color: var(--wr-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.log-description {
    color: var(--wr-text-main);
    margin-bottom: 8px;
    padding-left: 34px;
    font-size: 14px;
    line-height: 1.4;
}

.log-details {
    display: flex;
    gap: 12px;
    padding-left: 34px;
    flex-wrap: wrap;
}

.log-detail {
    font-size: 11px;
    padding: 3px 8px;
    background: var(--wr-accent-soft);
    border-radius: 3px;
    color: var(--wr-text-main);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.log-detail.positive {
    background: rgba(74, 157, 95, 0.2);
    color: #6dcc8a;
}

.log-detail.negative {
    background: rgba(184, 84, 80, 0.2);
    color: #ff8080;
}

/* Empty state */
.no-logs {
    text-align: center;
    padding: 60px 20px;
    color: var(--wr-text-muted);
    font-style: italic;
    background: var(--wr-bg-panel);
    border: 1px solid var(--wr-border);
    border-radius: 6px;
}

/* -------------------- LOG PAGINATION -------------------- */
.log-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
    padding: 14px;
    background: var(--wr-bg-panel);
    border: 1px solid var(--wr-border);
    border-radius: 6px;
}

#log-page-info {
    color: var(--wr-text-soft);
    font-size: 13px;
    min-width: 200px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* -------------------- LOG STATISTICS -------------------- */
.log-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 30px;
}

.stat-card {
    background: var(--wr-bg-panel);
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s ease;
}

.stat-card:hover {
    background: var(--wr-accent-hover);
    border-color: var(--wr-border-soft);
}

.stat-label {
    color: var(--wr-text-muted);
    font-size: 11px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-value {
    color: var(--wr-accent);
    font-size: 26px;
    font-weight: 700;
    font-family: 'Segoe UI', monospace;
}

/* -------------------- DASHBOARD ACTIVITY PREVIEW -------------------- */
.dash-activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(201,168,106,0.1);
}

.dash-activity-item:last-child {
    border-bottom: none;
}

.activity-type {
    color: var(--wr-accent);
    font-weight: 500;
    flex: 1;
}

.activity-time {
    color: var(--wr-text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Dashboard activity card specific */
#dash-activity-count {
    color: var(--wr-text-soft);
    margin-bottom: 10px;
    font-size: 13px;
}

#dash-activity-latest {
    margin-top: 8px;
}

/* -------------------- ACTION TYPE COLORS -------------------- */
.log-entry[data-action-type*="travel"] {
    border-left-color: #4aa3ff;
}

.log-entry[data-action-type*="travel"]:hover {
    border-left-color: #6db8ff;
}

.log-entry[data-action-type*="trade"] {
    border-left-color: #c9a86a;
}

.log-entry[data-action-type*="trade"]:hover {
    border-left-color: #d4b57a;
}

.log-entry[data-action-type*="mission"] {
    border-left-color: #7eb3d4;
}

.log-entry[data-action-type*="mission"]:hover {
    border-left-color: #8ec3e4;
}

.log-entry[data-action-type*="ship"] {
    border-left-color: #9a7fb8;
}

.log-entry[data-action-type*="ship"]:hover {
    border-left-color: #aa8fc8;
}

.log-entry[data-action-type*="combat"] {
    border-left-color: #b85450;
}

.log-entry[data-action-type*="combat"]:hover {
    border-left-color: #c86460;
}

.log-entry[data-action-type*="crew"] {
    border-left-color: #4a9d5f;
}

.log-entry[data-action-type*="crew"]:hover {
    border-left-color: #5aad6f;
}

/* -------------------- RESPONSIVE ADJUSTMENTS -------------------- */
@media (max-width: 768px) {
    .filter-row {
        flex-direction: column;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .log-details {
        padding-left: 0;
    }
    
    .log-description {
        padding-left: 0;
    }
    
    .log-pagination {
        flex-direction: column;
        gap: 10px;
    }
    
    .log-stats {
        grid-template-columns: 1fr;
    }
}

/* -------------------- FLEET MOBILE BREAKPOINT -------------------- */
@media (max-width: 768px) {
    .fleet-layout {
        grid-template-columns: 1fr;
    }
    .fleet-ship-dropdown {
        max-width: 100%;
    }
    .fleet-details-overview {
        flex-direction: column;
        gap: 8px;
    }
    .fleet-details-ship-image {
        text-align: center;
    }
    .fleet-ship-img {
        max-height: 120px;
    }
}

.activity-log-content {
    padding: 12px;
}

.activity-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--wr-text-muted);
    font-style: italic;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--wr-bg-panel);
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.activity-item:hover {
    background: var(--wr-accent-hover);
    border-color: var(--wr-border-soft);
}

.activity-icon {
    font-size: 20px;
    width: 30px;
    text-align: center;
    flex-shrink: 0;
}

.activity-details {
    flex: 1;
    min-width: 0;
}

.activity-action {
    font-weight: 600;
    color: var(--wr-accent);
    font-size: 13px;
    text-transform: capitalize;
}

.activity-description {
    font-size: 12px;
    color: var(--wr-text-soft);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.activity-credits {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
}

.activity-credits.positive {
    color: #6dcc8a;
    background: rgba(74, 157, 95, 0.2);
}

.activity-credits.negative {
    color: #ff8080;
    background: rgba(184, 84, 80, 0.2);
}

.activity-time {
    font-size: 11px;
    color: var(--wr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.activity-footer {
    margin-top: 12px;
    text-align: center;
}

.activity-footer .pr-button-flat {
    width: 100%;
}



/* ============================================================
   FULL WIDTH PANEL FIX - Merged and consolidated
   Ensures all main panels span full grid width
============================================================ */

/* Force all panels to span full width of grid container */
.wr-panel,
.shipssystem-panel {
    width: 100%;
    max-width: 100%;
    grid-column: 1 / -1; /* Span all columns */
}

/* Ensure panel content takes full width */
.wr-panel-content {
    width: 100%;
    max-width: 100%;
}

/* Make sure tables inside panels are full width */
.wr-panel .wr-table-wrapper {
    width: 100%;
}

.wr-panel .wr-table {
    width: 100%;
}

/* Log-specific full width ensures */
.log-stats {
    width: 100%;
}

.log-pagination {
    width: 100%;
}

.log-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
}

.log-details {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-row {
    width: 100%;
    display: flex;
    gap: 10px;
}

/* Filter dropdown dark theme styling */
.filter-select option {
    background: #1a1c20 !important;
    color: var(--wr-text-main) !important;
    padding: 8px;
}

.filter-select:hover {
    border-color: var(--wr-border-soft);
    background: var(--wr-bg-panel-alt) !important;
}

/* ---------------------------------------------------------
   AUTH PAGES
--------------------------------------------------------- */

.auth-body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 80px;
  color: var(--mer-text-color);
}

.auth-container {
  width: 100%;
  max-width: 480px;
  padding: 20px;
}

.auth-card {
  position: relative;
  padding: 28px 24px;
  border-radius: 12px;
  background: radial-gradient(
      circle at top left,
      rgba(255,255,255,0.12),
      transparent 55%
    ),
    var(--mer-card-glass-bg);
  border: 1px solid var(--mer-card-border);
  backdrop-filter: blur(10px);
  box-shadow:
    0 0 25px rgba(0,0,0,0.7),
    0 0 18px rgba(51,168,255,0.25);
  overflow: hidden;
}

.auth-card h1 {
  font-size: 1.4rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mer-accent-color);
  margin-bottom: 20px;
  text-align: center;
}

.auth-tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  gap: 20px;
}

.auth-tab {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--form-button-text);
  background: rgba(10, 40, 80, 0.5);
  border: 1px solid rgba(51,168,255,0.4);
  cursor: pointer;
  transition: 0.2s ease;
  text-decoration: none;
}

.auth-tab:hover {
  background: rgba(20, 70, 130, 0.8);
  box-shadow: 0 0 12px var(--mer-accent-soft);
}

.auth-success {
  background: rgba(109, 190, 109, 0.15);
  border: 1px solid rgba(109, 190, 109, 0.4);
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
  color: #6dbe6d;
  font-size: 0.9rem;
}

.auth-errors {
  background: rgba(255, 60, 60, 0.15);
  border: 1px solid rgba(255, 60, 60, 0.4);
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
  box-shadow: 0 0 10px rgba(255, 60, 60, 0.25);
}

.auth-errors ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.85rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  opacity: 0.85;
  gap: 6px;
}

.auth-form input {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid rgba(120,190,255,0.4);
  background: rgba(10, 25, 50, 0.55);
  color: var(--mer-text-color);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form input:focus {
  border-color: var(--mer-accent-color);
  box-shadow: 0 0 10px var(--mer-accent-soft);
}

.auth-form button {
  margin-top: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--form-button-bg);
  color: var(--form-button-text);
  border: 1px solid rgba(51,168,255,0.6);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 10px var(--mer-accent-soft);
  transition: box-shadow 0.2s ease, transform 0.15s ease, background-color 0.2s ease;
}

.auth-form button:hover {
  box-shadow: 0 0 18px var(--mer-accent-strong);
  transform: translateY(-2px);
  background-color: rgba(20, 70, 130, 0.95);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
  padding: 18px 20px;
  border-radius: 12px;
  background: radial-gradient(
      circle at top left,
      rgba(255,255,255,0.10),
      transparent 55%
    ),
    var(--mer-card-glass-bg);
  border: 1px solid var(--mer-card-border);
  backdrop-filter: blur(8px);
  box-shadow:
    0 0 18px rgba(0,0,0,0.6),
    0 0 14px rgba(51,168,255,0.20);
}

.auth-game-title {
  font-size: 1.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mer-accent-color);
  margin: 0 0 6px 0;
}

.auth-version {
  font-size: 0.85rem;
  opacity: 0.8;
  letter-spacing: 0.08em;
  color: var(--mer-text-color);
}

.galaxy-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 20px;
}

.galaxy-card {
  position: relative;
  padding: 22px 20px;
  border-radius: 12px;
  background: radial-gradient(
      circle at top left,
      rgba(255,255,255,0.12),
      transparent 55%
    ),
    var(--mer-card-glass-bg);
  border: 1px solid var(--mer-card-border);
  backdrop-filter: blur(10px);
  box-shadow:
    0 0 25px rgba(0,0,0,0.7),
    0 0 18px rgba(51,168,255,0.25);
  overflow: hidden;
  text-align: left;
}

.galaxy-card h2 {
  font-size: 1.2rem;
  margin: 0 0 8px 0;
  color: var(--mer-accent-color);
  letter-spacing: 0.08em;
}

.galaxy-card p {
  margin: 4px 0;
  opacity: 0.8;
  font-size: 0.9rem;
}

.galaxy-card button {
  display: inline-block;
  background-color: var(--form-button-bg);
  color: var(--form-button-text);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 0 10px var(--mer-accent-soft);
  border: 1px solid rgba(51,168,255,0.6);
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.15s ease, background-color 0.2s ease;
}

.galaxy-card button:hover {
  box-shadow: 0 0 18px var(--mer-accent-strong);
  transform: translateY(-2px);
  background-color: rgba(20, 70, 130, 0.95);
}

 .galaxy-body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 60px;
  color: var(--mer-text-color);
}

.galaxy-container {
  width: 100%;
  max-width: 900px;
  padding: 20px;
  text-align: center;
}

.galaxy-container h1 {
  font-size: 1.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mer-accent-color);
  margin-bottom: 25px;
}

.fleet-stats-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.fleet-stats-section {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.fleet-stats-section-title {
    font-weight: 600;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    opacity: 0.9;
}

.fleet-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
}

.fleet-stat-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.fleet-stat-values {
    display: flex;
    gap: 0.6rem;
}

.stat-base {
    opacity: 0.6;
}

.stat-bonus {
    color: #4ec9b0; /* teal bonus color */
}

.stat-final {
    font-weight: 600;
}

.loadout-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.loadout-grid-container {
    margin-bottom: 12px;
}

.loadout-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.loadout-slot {
    position: relative;
    width: 64px;
    height: 64px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.15s;
}

.loadout-slot.compatible {
    border-color: #4ec9b0;
    box-shadow: 0 0 8px #4ec9b0;
}
.loadout-slot.incompatible {
    opacity: 0.35;
    border-color: rgba(244, 67, 54, 0.4);
}

.loadout-slot.filled {
    background: rgba(255,255,255,0.05);
}

.loadout-clear-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    border: none;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 5;
}
.loadout-slot.filled:hover .loadout-clear-btn {
    display: flex;
}

.loadout-catalog {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.catalog-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.catalog-upgrade {
    padding: 0.5rem;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    cursor: grab;
    transition: 0.15s;
}

.catalog-upgrade:hover {
    border-color: #4ec9b0;
}

.catalog-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    margin: 0.75rem 0 0.4rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.catalog-section-title:first-child {
    margin-top: 0;
}

.catalog-section-title--equipped {
    color: rgba(78,201,176,0.55);
    border-bottom-color: rgba(78,201,176,0.2);
}

.catalog-empty {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.3);
    font-style: italic;
    padding: 0.5rem 0;
}

/* Fleet panel ship image */
.fleet-details-ship-image {
    padding: 0.75rem 0 0.5rem;
}

.fleet-ship-img {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
}

/* --------------------------------------------------------
   Upgrade slot icons
   -------------------------------------------------------- */
.upgrade-icon {
    width: 40px;
    height: 40px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
    opacity: 0.85;
}

.upgrade-icon-1 { background-image: url('../images/upgrade-engine.svg'); }
.upgrade-icon-2 { background-image: url('../images/upgrade-cargo.svg'); }
.upgrade-icon-3 { background-image: url('../images/upgrade-defense.svg'); }
.upgrade-icon-4 { background-image: url('../images/upgrade-weapon.svg'); }
.upgrade-icon-5 { background-image: url('../images/upgrade-utility.svg'); }
.upgrade-icon-generic { background-image: url('../images/upgrade-generic.svg'); }

/* Slot icon in grid: slightly smaller so it fits the 64px box with padding */
.loadout-slot .upgrade-icon {
    width: 44px;
    height: 44px;
    opacity: 0.7;
}

/* Filled slot: full brightness */
.loadout-slot.filled .upgrade-icon {
    opacity: 1;
}

/* Catalog upgrade inner layout */
.catalog-upgrade-inner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.catalog-upgrade-text {
    flex: 1;
    min-width: 0;
}

.catalog-upgrade-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.catalog-upgrade-bonus {
    font-size: 0.75rem;
    color: #4ec9b0;
    margin-top: 2px;
}

.stat-delta {
    animation: statPulse 0.4s ease;
}

@keyframes statPulse {
    0%   { color: #0ff; }
    100% { color: inherit; }
}

/* ============================================================
   TRADE ROUTE PANEL
   ============================================================ */

.fleet-route-section {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.fleet-route-section:last-child {
    border-bottom: none;
}
.fleet-route-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--wr-muted, #888);
    margin-bottom: 8px;
}

/* Captain's Log */
.fleet-log-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 260px;
    overflow-y: auto;
}
.fleet-log-row {
    font-size: 11px;
    display: flex;
    gap: 6px;
    align-items: baseline;
    flex-wrap: wrap;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.fleet-log-type {
    text-transform: uppercase;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    flex-shrink: 0;
    min-width: 46px;
}
.fleet-log-desc {
    flex: 1;
    color: var(--wr-text, #ccc);
}
.fleet-log-credits {
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Captain row */
.fleet-route-captain-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.fleet-route-captain-name {
    font-weight: 600;
    color: var(--wr-text, #eee);
}
.fleet-route-stat {
    font-size: 11px;
    color: var(--wr-muted, #888);
}
.fleet-route-assign-captain {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Mode buttons */
.fleet-mode-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.fleet-mode-btn {
    opacity: 0.55;
}
.fleet-mode-btn.active {
    opacity: 1;
    background: var(--wr-accent, #0df);
    color: #000;
}

/* Recall button — amber/orange */
.fleet-recall-btn {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
}
.fleet-recall-btn:hover:not(:disabled) {
    background: rgba(245, 158, 11, 0.35);
}
.fleet-recall-btn.active {
    opacity: 1;
    background: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
    cursor: default;
}

/* Extraction mode button */
.fleet-mode-btn--extraction {
    background: rgba(217, 119, 6, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(217, 119, 6, 0.4);
}
.fleet-mode-btn--extraction:hover:not(:disabled) {
    background: rgba(217, 119, 6, 0.35);
}
.fleet-mode-btn--extraction.active {
    opacity: 1;
    background: rgba(217, 119, 6, 0.3);
    color: #fbbf24;
}

/* Extraction status card */
.extraction-status-card {
    border: 1px solid rgba(217, 119, 6, 0.3);
    border-radius: 6px;
    padding: 12px;
    background: rgba(217, 119, 6, 0.05);
}
.extraction-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.extraction-badge {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
}
.extraction-stat {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 3px 0;
}
.extraction-stat-label {
    color: rgba(255,255,255,0.5);
    font-size: 11px;
}
.extraction-stats-row {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}
.extraction-stats-row .extraction-stat {
    flex-direction: column;
    gap: 2px;
}
.extraction-cargo {
    margin-top: 6px;
}
.extraction-cargo-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.extraction-cargo-item {
    font-size: 11px;
    padding: 2px 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
}
.extraction-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* ── Survey Mode (teal/cyan) ── */
.fleet-mode-btn--survey {
    background: rgba(0, 172, 193, 0.2);
    color: #26c6da;
    border: 1px solid rgba(0, 172, 193, 0.4);
}
.fleet-mode-btn--survey:hover:not(:disabled) {
    background: rgba(0, 172, 193, 0.35);
}
.fleet-mode-btn--survey.active {
    opacity: 1;
    background: rgba(0, 172, 193, 0.3);
    color: #4dd0e1;
}
.survey-status-card {
    border: 1px solid rgba(0, 172, 193, 0.3);
    border-radius: 6px;
    padding: 12px;
    background: rgba(0, 172, 193, 0.05);
}
.survey-config-card {
    border: 1px solid rgba(0, 172, 193, 0.3);
    border-radius: 6px;
    padding: 12px;
    background: rgba(0, 172, 193, 0.05);
}
.survey-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.survey-badge {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
}
.survey-stat {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 3px 0;
}
.survey-stat-label {
    color: rgba(255,255,255,0.5);
    font-size: 11px;
}
.survey-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.survey-config-field {
    margin-bottom: 10px;
}
.survey-config-label {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 4px;
}

/* Route form */
.fleet-route-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* P&L Summary (Captain's Log) */
.fleet-pnl-summary {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 10px;
}
.fleet-pnl-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.fleet-pnl-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
}
.fleet-pnl-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--wr-muted, #888);
}
.fleet-pnl-net {
    margin-left: auto;
    font-size: 13px;
}
.fleet-pnl-salary {
    font-size: 11px;
    color: var(--wr-muted, #888);
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* Cargo Hold (fleet details panel) */
.fleet-cargo-section {
    padding: 12px 0;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 4px;
}
.fleet-cargo-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--wr-muted, #888);
    margin-bottom: 8px;
}
.fleet-cargo-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12px;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.fleet-cargo-row:last-child {
    border-bottom: none;
}
.fleet-cargo-name {
    color: var(--wr-text, #ccc);
}
.fleet-cargo-qty {
    font-weight: 600;
    color: var(--wr-accent, #0df);
    flex-shrink: 0;
}
.fleet-cargo-empty {
    font-size: 11px;
    color: var(--wr-muted, #888);
    font-style: italic;
}
.fleet-cargo-used {
    font-size: 11px;
    color: var(--wr-muted, #888);
    margin-bottom: 6px;
}

/* Send-to-Base ferry row */
.fleet-send-to-base {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0 4px;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 4px;
}
.fleet-ferry-select {
    flex: 1;
    background: var(--wr-surface2, #1a1d24);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--wr-text, #ccc);
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* ============================================================
   PLAYER BASES PANEL
   ============================================================ */

.wr-panel-bases .bases-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    height: calc(100% - 90px);
}

/* Base selector (dropdown replacing old list column) */
.bases-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.bases-dropdown {
    flex: 1;
    max-width: 500px;
    padding: 10px 14px;
    background: var(--wr-bg-card, #1a1a2e);
    color: var(--wr-text, #e0e0e0);
    border: 1px solid var(--wr-border-soft, rgba(255,255,255,0.1));
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}
.bases-dropdown:focus {
    outline: none;
    border-color: var(--wr-accent, #4fd1ff);
}

.bases-count {
    color: var(--wr-text-soft, #aaa);
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Center column: details + log stacked */
.bases-center-col { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; }
.bases-center-col .bases-details { flex: 0 0 auto; }
.bases-log-card { flex: 0 0 auto; padding: 12px; }
.bases-log-card .bases-section-title { margin-top: 0; }

/* Details center panel */
.bases-details { overflow-y: auto; padding: 12px; }

.base-details-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.base-details-icon { font-size: 28px; color: var(--wr-accent); }
.base-details-title-group { flex: 1; }
.base-details-name { font-size: 16px; font-weight: 700; color: var(--wr-accent); }
.base-details-type { font-size: 11px; color: var(--wr-text-muted); text-transform: capitalize; }
.base-rename-btn { padding: 3px 8px; font-size: 12px; }

.base-construction-bar { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.base-construction-fill { height: 100%; background: #ff9800; border-radius: 3px; transition: width 0.5s; }

.base-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.base-detail-item {
    background: var(--wr-bg-panel-alt);
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    padding: 8px 10px;
}
.base-detail-label { font-size: 10px; color: var(--wr-text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.base-detail-value { font-size: 13px; color: var(--wr-text-main); font-weight: 500; }

/* Context panel tabs */
.bases-context { overflow: hidden; display: flex; flex-direction: column; padding: 0; }

.bases-tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--wr-border);
    flex-shrink: 0;
}
.bases-tabs .wr-tab {
    flex: 1 1 23%;
    min-width: 0;
    text-align: center;
    padding: 8px 4px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    color: var(--wr-text-muted);
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}
.bases-tabs .wr-tab:hover { color: var(--wr-text-main); }
.bases-tabs .wr-tab.active { color: var(--wr-accent); border-bottom-color: var(--wr-accent); }

.bases-tab { display: none; overflow-y: auto; flex: 1; padding: 10px; }
.bases-tab.active { display: block; }

/* Overview tab */
.bases-stats-section { margin-bottom: 14px; }
.bases-stats-section-title { font-size: 11px; font-weight: 600; color: var(--wr-accent); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; display: flex; align-items: center; gap: 4px; }

.base-stat-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--wr-border); }
.base-stat-label { font-size: 12px; color: var(--wr-text-soft); }
.base-stat-value { font-size: 12px; color: var(--wr-text-main); font-weight: 500; }

.power-bar-wrap { margin-top: 6px; }
.power-bar-track { height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
.power-bar-fill { height: 100%; border-radius: 4px; transition: width 0.4s; }

/* Modules tab */
.modules-power-summary {
    font-size: 11px;
    color: var(--wr-text-muted);
    padding: 6px 0 10px;
    border-bottom: 1px solid var(--wr-border);
    margin-bottom: 8px;
}
.modules-power-summary .power-label { color: var(--wr-accent); font-weight: 600; }

.bases-module-grid { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }

.mod-slot {
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    padding: 8px 10px;
    background: var(--wr-bg-panel);
}
.mod-slot.empty { border-style: dashed; opacity: 0.5; text-align: center; }
.mod-slot-empty-label { font-size: 11px; color: var(--wr-text-muted); }
.mod-slot-empty-sub { font-size: 10px; color: var(--wr-text-muted); opacity: 0.6; }

.mod-slot-header { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.mod-slot-icon { font-size: 14px; }
.mod-slot-name { flex: 1; font-size: 12px; font-weight: 600; color: var(--wr-text-main); }
.mod-slot-status { font-size: 8px; }
.mod-slot-meta { font-size: 10px; color: var(--wr-text-muted); margin-bottom: 3px; }
.mod-slot-stats { font-size: 10px; color: var(--wr-accent); margin-bottom: 3px; }
.mod-remove-btn { font-size: 10px; padding: 2px 6px; margin-top: 4px; }

.mod-build-progress { height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.mod-build-progress div { height: 100%; background: #ff9800; }
.mod-build-eta, .def-build-eta { display: block; font-size: 9px; color: var(--wr-text-soft, #999); margin-top: 2px; }

.power-gen { font-size: 10px; color: #4caf50; font-weight: 600; }
.power-use { font-size: 10px; color: #f44336; font-weight: 600; }

/* Module catalog */
.catalog-title { font-size: 11px; color: var(--wr-accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.bases-module-catalog { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }

.mod-catalog-card {
    border: 1px solid var(--wr-border);
    border-radius: 5px;
    padding: 7px 9px;
    cursor: pointer;
    transition: background 0.15s;
}
.mod-catalog-card:hover { background: var(--wr-accent-hover); }
.mod-catalog-card.selected { background: var(--wr-accent-strong); border-color: var(--wr-border-strong); }
.mod-catalog-card.cant-afford { opacity: 0.5; }
.mod-catalog-category-header, .mod-grid-category-header {
    grid-column: 1 / -1;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--wr-text-soft);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 6px 2px 4px;
    margin-top: 4px;
}

.mod-cat-header { display: flex; align-items: center; gap: 5px; margin-bottom: 2px; }
.mod-cat-name { flex: 1; font-size: 12px; font-weight: 600; color: var(--wr-text-main); }
.mod-cat-cost { font-size: 10px; color: var(--wr-text-muted); margin-bottom: 2px; }
.mod-cat-stats { font-size: 10px; color: var(--wr-accent); margin-bottom: 2px; }
.mod-cat-desc { font-size: 10px; color: var(--wr-text-soft); }

.bases-module-actions { margin-top: 6px; }

/* Hangar tab */
.bases-hangar-ships { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }

.hangar-ship-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    background: var(--wr-bg-panel);
}
.hangar-ship-icon { font-size: 20px; }
.hangar-ship-info { flex: 1; }
.hangar-ship-name { font-size: 13px; font-weight: 600; color: var(--wr-text-main); }
.hangar-ship-integrity { font-size: 11px; }

.bases-hangar-actions { display: flex; gap: 6px; }
.bases-hangar-actions .wr-btn { flex: 1; font-size: 12px; }

/* Build modal */
.bases-build-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.bases-form-label { font-size: 11px; color: var(--wr-text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: -6px; }

.bases-type-selector { display: flex; gap: 6px; }
.bases-type-option {
    flex: 1;
    text-align: center;
    padding: 10px 6px;
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.bases-type-option:hover { background: var(--wr-accent-hover); }
.bases-type-option.active { background: var(--wr-accent-strong); border-color: var(--wr-border-strong); }
.bases-type-icon { font-size: 22px; margin-bottom: 4px; }
.bases-type-label { font-size: 12px; font-weight: 600; color: var(--wr-text-main); }
.bases-type-cost { font-size: 10px; color: var(--wr-text-muted); margin-top: 2px; }

.bases-build-requirements { background: var(--wr-bg-panel-alt); border: 1px solid var(--wr-border); border-radius: 6px; padding: 8px 10px; }
.build-req-title { font-size: 11px; color: var(--wr-accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 5px; }
.build-req-row { display: flex; justify-content: space-between; font-size: 11px; padding: 3px 0; border-bottom: 1px solid var(--wr-border); color: var(--wr-text-soft); }
.build-req-row:last-child { border-bottom: none; }
.build-req-row.req-missing { color: #f44336; }

.bases-placeholder { padding: 20px; text-align: center; color: var(--wr-text-muted); font-size: 12px; line-height: 1.6; }

/* ============================================================
   BASES PHASE 2 — Market, Production, Workers tabs
   ============================================================ */

/* Shared section title */
.bases-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--wr-accent);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin: 4px 0 6px;
}
.bases-section-title-sep { margin-top: 14px; }
.bases-placeholder-sm { font-size: 11px; color: var(--wr-text-muted); padding: 8px 0; font-style: italic; }

/* Shared data table */
.bases-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.bases-table th {
    text-align: left;
    color: var(--wr-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.4px;
    padding: 4px 6px;
    border-bottom: 1px solid var(--wr-border);
}
.bases-table td {
    padding: 5px 6px;
    border-bottom: 1px solid var(--wr-border);
    color: var(--wr-text-soft);
    vertical-align: middle;
}
.bases-table tr:last-child td { border-bottom: none; }
.bases-table tr:hover td { background: var(--wr-bg-panel-alt); }
.wr-btn-xs {
    padding: 2px 7px;
    font-size: 10px;
    height: auto;
    min-height: unset;
}

/* Market tab */
.bases-market-wrapper { display: flex; flex-direction: column; gap: 4px; }
.bases-market-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.bases-inventory-list, .bases-market-list { overflow-x: auto; }

/* Add listing modal */
.bases-listing-prices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* Production tab */
.bases-production-wrapper { display: flex; flex-direction: column; gap: 4px; }
.bases-production-actions { margin-top: 8px; }

.prod-job-row {
    background: var(--wr-bg-panel-alt);
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
}
.prod-job-row.prod-job-done { opacity: 0.55; }
.prod-job-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.prod-job-name { font-size: 12px; font-weight: 600; color: var(--wr-text-main); }
.prod-job-status { font-size: 10px; }
.prod-job-meta { font-size: 11px; color: var(--wr-text-muted); margin-bottom: 5px; }
.prod-job-bar-track {
    height: 4px;
    background: var(--wr-border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 5px;
}
.prod-job-bar-fill {
    height: 100%;
    background: var(--wr-accent);
    border-radius: 2px;
    transition: width 0.3s;
}
.prod-job-actions { display: flex; justify-content: flex-end; }

/* Queue recipe modal */
.bases-recipe-modal { max-width: 480px; }
.bases-recipe-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.recipe-card {
    padding: 8px 10px;
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    background: var(--wr-bg-panel-alt);
}
.recipe-card:hover { background: var(--wr-accent-hover); }
.recipe-card.selected { border-color: var(--wr-accent); background: var(--wr-accent-strong); }
.recipe-header { display: flex; justify-content: space-between; align-items: center; }
.recipe-name { font-size: 12px; font-weight: 600; color: var(--wr-text-main); }
.recipe-output { font-size: 11px; color: #4caf50; }
.recipe-meta { font-size: 10px; color: var(--wr-text-muted); margin-top: 3px; }
.bases-recipe-qty-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }

/* Workers tab */
.bases-workers-wrapper { display: flex; flex-direction: column; gap: 4px; }
.bases-workers-actions { margin-top: 8px; }
.workers-capacity {
    font-size: 11px;
    color: var(--wr-text-muted);
    margin-bottom: 6px;
    padding: 4px 0;
    border-bottom: 1px solid var(--wr-border);
}
.contract-type-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: var(--wr-accent-strong);
    color: var(--wr-accent);
}

.npc-mode-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-left: 5px;
    background: rgba(255,255,255,0.07);
    color: var(--wr-muted);
}
.npc-mode-badge.income-mode {
    background: rgba(34,197,94,0.12);
    color: #4ade80;
}
.npc-level-badge {
    font-size: 0.8em;
    color: #aaa;
    font-weight: 600;
    margin-left: 4px;
}
.npc-order-badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.npc-order-badge.mining {
    background: rgba(245,158,11,0.15);
    color: #f59e0b;
}
.npc-order-badge.trading {
    background: rgba(74,222,128,0.12);
    color: #4ade80;
}
.npc-order-badge.sell-order {
    background: rgba(96,165,250,0.15);
    color: #60a5fa;
}
.npc-order-state {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    background: rgba(255,255,255,0.06);
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-left: 4px;
}
.npc-order-state.paused {
    background: rgba(245,158,11,0.15);
    color: #f59e0b;
}

.auto-list-badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: rgba(255,255,255,0.06);
    color: var(--wr-muted);
    border: 1px solid rgba(255,255,255,0.1);
    transition: background 0.15s, color 0.15s;
}
.auto-list-badge.active {
    background: rgba(139,92,246,0.18);
    color: #a78bfa;
    border-color: rgba(139,92,246,0.35);
}

/* ============================================================
   SUPPLY CONTRACT NEGOTIATION
   ============================================================ */
.nego-modal { max-width: 460px; }
.nego-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.nego-faction-name { font-weight: 600; font-size: 14px; color: #e0e0e0; }
.nego-round-indicator { margin-left: auto; font-size: 11px; color: #aaa; background: rgba(255,255,255,0.06); padding: 2px 8px; border-radius: 10px; }

.nego-type-badge {
    display: inline-block; padding: 2px 8px; border-radius: 3px;
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.nego-type-military       { background: rgba(239,68,68,0.15); color: #f87171; }
.nego-type-government     { background: rgba(59,130,246,0.15); color: #60a5fa; }
.nego-type-corporation    { background: rgba(168,162,158,0.15); color: #d6d3d1; }
.nego-type-scientific     { background: rgba(34,211,238,0.15); color: #67e8f9; }
.nego-type-merchant_guild { background: rgba(250,204,21,0.15); color: #fde047; }
.nego-type-religious      { background: rgba(192,132,252,0.15); color: #c084fc; }
.nego-type-pirate         { background: rgba(251,146,60,0.15); color: #fb923c; }

.nego-dialogue-box {
    display: flex; gap: 10px; align-items: flex-start;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px; padding: 12px; margin-bottom: 14px;
}
.nego-dialogue-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.nego-dialogue-text { font-size: 13px; line-height: 1.5; color: #ccc; font-style: italic; }

.nego-offer-display {
    text-align: center; margin-bottom: 14px; padding: 10px;
    background: rgba(74,222,128,0.06); border: 1px solid rgba(74,222,128,0.15); border-radius: 6px;
}
.nego-offer-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #888; margin-bottom: 4px; }
.nego-offer-price { font-size: 22px; font-weight: 700; color: #4ade80; }
.nego-offer-goods { font-size: 11px; color: #aaa; margin-top: 2px; }

.nego-counter-section { margin-bottom: 10px; }
.nego-counter-row { display: flex; gap: 8px; align-items: center; }
.nego-counter-row .wr-input { flex: 1; }

.nego-outcome-box { border-color: rgba(255,255,255,0.12); }
.nego-actions { gap: 8px; }

/* Crew negotiation — rarity badge variants */
.crew-rarity-common    { background: rgba(170,170,170,0.15); color: #aaa; }
.crew-rarity-uncommon  { background: rgba(74,222,128,0.15);  color: #4ade80; }
.crew-rarity-rare      { background: rgba(96,165,250,0.15);  color: #60a5fa; }
.crew-rarity-legendary { background: rgba(245,158,11,0.15);  color: #f59e0b; }

/* Crew negotiation — stats row */
.crew-nego-stats {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    margin-bottom: 10px; font-size: 12px; color: #ccc;
}
.crew-stat { display: inline-flex; align-items: center; gap: 2px; }
.crew-stat-role {
    background: rgba(255,255,255,0.06); padding: 2px 8px; border-radius: 3px;
    font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: #aaa;
}
.crew-stat-personality {
    font-size: 10px; color: #888; font-style: italic;
}

/* Crew negotiation — role mismatch warning */
.crew-nego-mismatch {
    background: rgba(251,146,60,0.1); border: 1px solid rgba(251,146,60,0.25);
    border-radius: 4px; padding: 6px 10px; margin-bottom: 10px;
    font-size: 12px; color: #fb923c; font-style: italic;
}

/* ============================================================
   DEFENSE TAB — Phase 3
   ============================================================ */
.bases-defense-wrapper { display: flex; flex-direction: column; gap: 12px; }

/* Defense slot grid */
.bases-defense-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}
/* Station/citadel get wider grid automatically via JS-rendered count */

.def-slot {
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    background: var(--wr-bg-panel-alt);
    min-height: 64px;
}
.def-slot.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0.45;
    cursor: default;
}
.def-slot.occupied:hover { background: var(--wr-accent-hover); }
.def-slot.occupied.selected { border-color: var(--wr-accent); background: var(--wr-accent-strong); }

.def-slot-empty-label { font-size: 11px; color: var(--wr-text-muted); }
.def-slot-empty-sub   { font-size: 10px; color: var(--wr-text-muted); opacity: 0.6; }

.def-slot-header {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 2px;
}
.def-slot-icon   { font-size: 14px; }
.def-slot-name   { font-size: 11px; font-weight: 600; color: var(--wr-text-main); flex: 1; }
.def-slot-status { font-size: 10px; }
.def-slot-meta   { font-size: 10px; color: var(--wr-text-muted); }

.def-build-progress {
    height: 3px;
    background: var(--wr-border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 5px;
}
.def-build-progress > div {
    height: 100%;
    background: #ff9800;
    border-radius: 2px;
    transition: width 0.3s;
}

/* Defense catalog */
.bases-defense-catalog {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 260px;
    overflow-y: auto;
}
.def-catalog-card {
    padding: 8px 10px;
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    background: var(--wr-bg-panel-alt);
}
.def-catalog-card:hover { background: var(--wr-accent-hover); }
.def-catalog-card.selected { border-color: var(--wr-accent); background: var(--wr-accent-strong); }
.def-catalog-card.cant-afford { opacity: 0.5; }

.def-cat-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}
.def-cat-name  { font-size: 12px; font-weight: 600; color: var(--wr-text-main); flex: 1; }
.def-cat-power { font-size: 10px; }
.def-tier-req  { font-size: 10px; color: #ff9800; font-style: italic; }
.def-cat-cost  { font-size: 10px; color: var(--wr-text-muted); margin-bottom: 2px; }
.def-cat-desc  { font-size: 10px; color: var(--wr-text-muted); }

/* Defense action buttons */
.bases-defense-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Faction HQ section */
.hq-info   { display: flex; align-items: center; gap: 8px; flex: 1; }
.hq-label  { font-size: 12px; color: var(--wr-text-muted); }
.hq-badge  {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    background: #ffd60020;
    color: #ffd600;
    border: 1px solid #ffd60040;
}

/* ============================================================
   LOG TAB — Phase 3
   ============================================================ */
.bases-log-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 420px;
    overflow-y: auto;
}

.log-entry-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid var(--wr-border);
    border-radius: 5px;
    background: var(--wr-bg-panel-alt);
    font-size: 11px;
}

.log-event-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.log-entry-desc {
    color: var(--wr-text-main);
    flex: 1;
    line-height: 1.4;
}

.log-entry-meta {
    color: var(--wr-text-muted);
    font-size: 10px;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: center;
}

/* -------------------- BASES MOBILE BREAKPOINT -------------------- */
@media (max-width: 768px) {
    .wr-panel-bases .bases-layout {
        grid-template-columns: 1fr;
    }
    .bases-dropdown {
        max-width: 100%;
    }
    .bases-selector {
        flex-direction: column;
        align-items: stretch;
    }
    .bases-tabs .wr-tab {
        flex: 1 1 auto;
        padding: 8px 6px;
        font-size: 10px;
    }
}

/* ============================================================
   MAP DETAIL — Bases in System (Phase 3)
   ============================================================ */
.map-bases-section {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--wr-border);
}
.map-bases-header {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--wr-text-muted);
    margin-bottom: 5px;
}
.map-base-row {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 4px 0;
    font-size: 11px;
}
.map-base-row.map-base-own { color: #4dd9e0; }
.map-base-row-header { display: flex; align-items: center; gap: 6px; width: 100%; }
.map-base-icon { font-size: 12px; flex-shrink: 0; }
.map-base-name { flex: 1; color: var(--wr-text-main); }
.map-market-badge {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.4px;
    background: rgba(139,92,246,0.15);
    color: #a78bfa;
    border: 1px solid rgba(139,92,246,0.25);
    flex-shrink: 0;
}
.map-base-market {
    margin: 4px 0 2px 18px;
    font-size: 10px;
}
.map-market-row { width: 100%; border-collapse: collapse; }
.map-market-row th,
.map-market-row td { padding: 1px 4px; text-align: left; }
.map-market-row thead th { color: var(--wr-text-muted); font-weight: 600; }
.map-market-goods { flex: 1; }
.map-market-prices { color: var(--wr-text-muted); text-align: right; }

/* ============================================================
   HEADER LAYOUT UTILITIES
============================================================ */
.wr-row {
    display: flex;
    align-items: center;
}
.wr-text-soft {
    color: var(--wr-text-muted);
}
.map-base-meta { font-size: 10px; flex-shrink: 0; }
.map-tp-expiry-badge {
    font-size: 10px;
    color: #ff9800;
    background: rgba(255,152,0,0.12);
    padding: 1px 6px;
    border-radius: 3px;
    animation: tp-pulse-amber 2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes tp-pulse-amber {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* ============================================================
   MAP — Filter Toggle Bar
============================================================ */
.map-filter-bar {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    display: flex;
    gap: 12px;
}
.map-filter-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: rgba(200, 220, 255, 0.8);
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    user-select: none;
}
.map-filter-toggle:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.2);
}
.map-filter-toggle input[type="checkbox"] {
    margin: 0;
    accent-color: #33a8ff;
}
.map-filter-icon {
    font-size: 9px;
}

/* ============================================================
   MAP DETAIL — Find Nearest Station
============================================================ */
.map-find-nearest {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--wr-border);
}
.map-find-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--wr-text-muted);
    margin-bottom: 6px;
}
.map-find-select {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    color: #fff;
    font-size: 11px;
    padding: 4px 6px;
    margin-bottom: 6px;
}
.map-find-select option {
    background: #1a2035;
    color: #e0e0e0;
}
.map-find-btn {
    width: 100%;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 4px;
    color: var(--wr-text-main);
    font-size: 11px;
    padding: 4px 0;
    cursor: pointer;
    margin-bottom: 6px;
}
.map-find-btn:hover { background: rgba(255,255,255,0.08); }
.map-find-loading,
.map-find-empty {
    font-size: 11px;
    color: var(--wr-text-muted);
    padding: 4px 0;
}
.map-find-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.map-find-num {
    font-size: 10px;
    color: var(--wr-text-muted);
    flex-shrink: 0;
    width: 12px;
    text-align: right;
}
.map-find-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.map-find-station {
    font-size: 11px;
    color: var(--wr-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.map-find-meta {
    font-size: 10px;
    color: var(--wr-text-muted);
}
.map-find-go {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 3px;
    color: var(--wr-accent);
    font-size: 11px;
    padding: 1px 5px;
    cursor: pointer;
    flex-shrink: 0;
}
.map-find-go:hover { background: rgba(255,255,255,0.08); }

/* Help context button — sits in panel headers */
.wr-btn-help {
    margin-left: auto;
    padding: 2px 9px;
    background: transparent;
    border: 1px solid var(--wr-border);
    border-radius: 50%;
    color: var(--wr-text-muted);
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1.4;
    transition: border-color 0.15s, color 0.15s;
}
.wr-btn-help:hover {
    border-color: var(--wr-accent);
    color: var(--wr-accent);
}

/* ============================================================
   HELP PANEL
============================================================ */
.wr-panel-help .wr-panel-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
}

/* Category tab strip */
.wr-help-cat-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--wr-border);
    background: var(--wr-bg-dark);
}

.wr-help-cat-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--wr-bg-card);
    border: 1px solid var(--wr-border);
    border-radius: 4px;
    color: var(--wr-text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.wr-help-cat-btn:hover {
    background: var(--wr-bg-hover);
    color: var(--wr-text);
}

.wr-help-cat-btn.active {
    background: var(--wr-accent-dim);
    border-color: var(--wr-accent);
    color: var(--wr-accent);
}

.wr-help-cat-icon {
    font-size: 1rem;
    line-height: 1;
}

.wr-help-cat-label {
    white-space: nowrap;
}

/* Article list */
.wr-help-article-list {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.wr-help-article-card {
    border: 1px solid var(--wr-border);
    border-radius: 4px;
    overflow: hidden;
}

.wr-help-article-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--wr-bg-card);
    border: none;
    color: var(--wr-text);
    font-size: 0.9rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.wr-help-article-toggle:hover {
    background: var(--wr-bg-hover);
}

.wr-help-article-title {
    font-weight: 500;
}

.wr-help-article-chevron {
    color: var(--wr-text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.wr-help-article-body {
    padding: 14px 16px;
    background: var(--wr-bg-dark);
    color: var(--wr-text);
    font-size: 0.85rem;
    line-height: 1.6;
    border-top: 1px solid var(--wr-border);
}

.wr-help-article-body p { margin: 0 0 10px; }
.wr-help-article-body ul, .wr-help-article-body ol { margin: 0 0 10px; padding-left: 20px; }
.wr-help-article-body li { margin-bottom: 4px; }
.wr-help-article-body table { width: 100%; border-collapse: collapse; margin-bottom: 10px; font-size: 0.82rem; }
.wr-help-article-body th { background: var(--wr-bg-card); color: var(--wr-text-muted); padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--wr-border); }
.wr-help-article-body td { padding: 6px 10px; border-bottom: 1px solid var(--wr-border-dim, rgba(255,255,255,0.05)); }
.wr-help-article-body code, .wr-help-article-body pre { background: var(--wr-bg-card); padding: 2px 6px; border-radius: 3px; font-family: monospace; font-size: 0.82rem; }

/* ============================================================
   NEWS TICKER — card_news_ticker.php  (horizontal marquee)
============================================================ */
.ticker-marquee {
    display: flex;
    align-items: center;
    background: rgba(10,12,18,0.85);
    border: 1px solid var(--wr-border, rgba(201,168,106,0.25));
    border-radius: 6px;
    overflow: hidden;
    cursor: default;
    height: 36px;
    max-width: 1800px;
    margin: 0 auto 4px;
    width: calc(100% - 40px);
}

.ticker-marquee-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    background: rgba(201,168,106,0.08);
    border-right: 1px solid var(--wr-border, rgba(201,168,106,0.25));
    height: 100%;
    flex-shrink: 0;
}

.ticker-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--wr-accent, #c9a86a);
    white-space: nowrap;
}

.ticker-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
    animation: tickerPulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes tickerPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.3; transform: scale(0.6); }
}

.ticker-marquee-track {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
    mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
}

.ticker-marquee-scroll {
    display: flex;
    align-items: center;
    white-space: nowrap;
    animation: tickerScroll 60s linear infinite;
    padding-left: 100%;
}

@keyframes tickerScroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

.ticker-marquee:hover .ticker-marquee-scroll {
    animation-play-state: paused;
}

.ticker-marquee-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 18px 0 0;
    flex-shrink: 0;
}

.ticker-marquee-item::after {
    content: '\00b7';
    color: var(--wr-text-muted, #555);
    font-size: 1.2rem;
    padding-left: 18px;
}

.ticker-marquee-item:last-child::after { content: none; }

.ticker-type-tag {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--wr-accent, #c9a86a);
    background: rgba(201,168,106,0.12);
    border: 1px solid rgba(201,168,106,0.25);
    border-radius: 3px;
    padding: 1px 5px;
    white-space: nowrap;
}

.ticker-title {
    color: var(--wr-text-main, #e3e7ec);
    font-size: 0.78rem;
    white-space: nowrap;
}

.ticker-when {
    font-size: 0.68rem;
    color: var(--wr-text-muted, #888);
    white-space: nowrap;
}

/* Diplomacy event ticker tags */
.ticker-type-tag--war {
    color: #ef4444;
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.4);
}
.ticker-type-tag--embargo {
    color: #f97316;
    background: rgba(249,115,22,0.15);
    border-color: rgba(249,115,22,0.35);
}
.ticker-type-tag--alliance {
    color: #4ade80;
    background: rgba(74,222,128,0.15);
    border-color: rgba(74,222,128,0.35);
}
.ticker-type-tag--ceasefire {
    color: #fbbf24;
    background: rgba(251,191,36,0.15);
    border-color: rgba(251,191,36,0.35);
}
.ticker-type-tag--diplomacy {
    color: #a78bfa;
    background: rgba(167,139,250,0.12);
    border-color: rgba(167,139,250,0.3);
}
.ticker-type-tag--frontier {
    color: #00cc88;
    background: rgba(0,204,136,0.12);
    border-color: rgba(0,204,136,0.3);
}

/* Announcement ticker tags */
.ticker-type-tag--patch {
    color: #2dd4bf;
    background: rgba(45,212,191,0.15);
    border-color: rgba(45,212,191,0.4);
}
.ticker-type-tag--announcement {
    color: #60a5fa;
    background: rgba(96,165,250,0.15);
    border-color: rgba(96,165,250,0.35);
}
.ticker-type-tag--maintenance {
    color: #fb923c;
    background: rgba(251,146,60,0.15);
    border-color: rgba(251,146,60,0.35);
}
.ticker-type-tag--logistics {
    color: #ffa500;
    background: rgba(255,165,0,0.15);
    border-color: rgba(255,165,0,0.35);
}

/* Ticker announcement modal */
.ticker-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}
.ticker-modal-box {
    background: #0a0e1a;
    border: 1px solid var(--wr-border);
    border-radius: 8px;
    padding: 20px 24px;
    min-width: 320px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}
.ticker-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.ticker-modal-when {
    font-size: 0.75rem;
    color: var(--wr-text-muted);
}
.ticker-modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--wr-accent);
    margin: 0 0 12px;
}
.ticker-modal-body {
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.6;
    white-space: pre-line;
}
.ticker-modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

/* ============================================================
   FACTIONS PANEL — panel-factions.js
============================================================ */
.factions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* ============================================================
   EVENTS PANEL — panel-events.js
============================================================ */
.wr-panel-events {
    padding: 16px;
}

.events-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.events-loading,
.events-error {
    padding: 32px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--wr-text-muted, #888);
}

.events-error { color: #e07070; }

.events-empty {
    padding: 40px;
    text-align: center;
    font-size: 0.95rem;
    color: var(--wr-text-muted, #888);
}

.events-empty-sub {
    display: block;
    font-size: 0.78rem;
    color: var(--wr-text-muted, #888);
    margin-top: 6px;
    opacity: 0.7;
}

.events-section {
    margin-bottom: 20px;
}

.events-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--wr-accent, #c9a86a);
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--wr-border, rgba(201,168,106,0.25));
}

.events-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.events-card {
    background: var(--wr-bg-panel, rgba(255,255,255,0.03));
    border: 1px solid var(--wr-border, rgba(201,168,106,0.25));
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.15s;
}

.events-card:hover { border-color: rgba(201,168,106,0.45); }

.events-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
}

.events-type-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 2px;
}

.events-card-title {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--wr-text-main, #e3e7ec);
    margin: 0;
}

.events-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 3px;
    flex-shrink: 0;
}

.events-badge-active {
    background: rgba(76,175,125,0.18);
    color: #4caf7d;
    border: 1px solid rgba(76,175,125,0.35);
}

.events-badge-resolved {
    background: rgba(150,160,175,0.12);
    color: #8899aa;
    border: 1px solid rgba(150,160,175,0.25);
}

.events-card-desc {
    padding: 0 14px 10px;
    font-size: 0.82rem;
    color: var(--wr-text-soft, #aaa);
    line-height: 1.5;
    margin: 0;
}

.events-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px 10px;
    flex-wrap: wrap;
}

.events-type-tag {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--wr-accent, #c9a86a);
    background: rgba(201,168,106,0.1);
    border: 1px solid rgba(201,168,106,0.25);
    border-radius: 3px;
    padding: 1px 6px;
}

.events-card-tick {
    font-size: 0.72rem;
    color: var(--wr-text-muted, #888);
}

.events-count {
    font-size: 0.72rem;
    color: var(--wr-text-muted, #888);
}

.events-effects {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 0 14px 10px;
}

.events-effect-tag {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 3px;
    border: 1px solid rgba(100,160,255,0.3);
    background: rgba(70,130,220,0.1);
    color: #88aadd;
}

.events-progress-list {
    padding: 0 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.events-progress-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.events-progress-label {
    font-size: 0.78rem;
    color: var(--wr-text-soft, #aaa);
}

.events-progress-vals {
    font-size: 0.72rem;
    color: var(--wr-text-muted, #888);
    text-align: right;
    margin-bottom: 2px;
}

.events-progress-bar-wrap {
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    height: 6px;
    overflow: hidden;
}

.events-progress-bar {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #4aa3ff, #4caf7d);
    transition: width 0.4s ease;
    min-width: 2px;
}

.events-card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 8px 14px;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.1);
    gap: 8px;
}

.events-contribute-btn {
    font-size: 0.78rem;
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid rgba(201,168,106,0.4);
    background: rgba(201,168,106,0.1);
    color: var(--wr-accent, #c9a86a);
    cursor: pointer;
    transition: background 0.15s;
}

.events-contribute-btn:hover {
    background: rgba(201,168,106,0.2);
}

.events-engage-btn {
    font-size: 0.78rem;
    padding: 4px 12px;
    border-radius: 4px;
    background: transparent;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    cursor: pointer;
    transition: background 0.15s;
}

.events-engage-btn:hover {
    background: rgba(231,76,60,0.2);
}

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

.events-contribute-msg {
    font-size: 0.78rem;
    color: var(--wr-text-muted, #888);
}

/* War Score Panel */
.events-war-panel {
    margin: 10px 0;
    padding: 10px 12px;
    background: rgba(0,0,0,0.25);
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
}

.events-war-score {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.events-war-side {
    flex: 1;
    text-align: center;
}

.events-war-faction {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.events-war-bar-wrap {
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 2px;
}

.events-war-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.events-war-pts {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.6);
}

.events-war-vs {
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    flex-shrink: 0;
    padding: 0 4px;
}

.events-war-threshold {
    text-align: center;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
    margin-bottom: 8px;
}

.events-war-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.events-war-btn {
    flex: 1;
    font-size: 0.75rem;
    padding: 5px 8px;
    border-radius: 4px;
    background: transparent;
    border: 1px solid;
    cursor: pointer;
    transition: background 0.15s;
    font-weight: 600;
}

.events-war-btn:hover {
    background: rgba(255,255,255,0.08);
}

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

.events-war-supply {
    display: flex;
    gap: 6px;
}

.events-war-supply-btn {
    flex: 1;
    font-size: 0.72rem;
    padding: 4px 6px;
    border-radius: 4px;
    background: transparent;
    border: 1px solid;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    transition: background 0.15s;
}

.events-war-supply-btn:hover {
    background: rgba(255,255,255,0.06);
}

.events-war-supply-hint {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.5);
    font-style: italic;
}

/* Events Contribute Modal */
.events-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    animation: eventsFadeIn 0.15s ease;
}

@keyframes eventsFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.events-modal {
    background: #1a1f2b;
    border: 1px solid var(--wr-border-soft, rgba(201,168,106,0.35));
    border-radius: 8px;
    padding: 20px 24px;
    width: 340px;
    max-width: 92vw;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.events-modal h3 {
    margin: 0 0 16px;
    font-size: 1rem;
    color: var(--wr-accent, #c9a86a);
}

.events-modal-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.events-modal-row label {
    font-size: 0.78rem;
    color: var(--wr-text-soft, #aaa);
}

.events-modal-row input {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(201,168,106,0.3);
    border-radius: 4px;
    color: var(--wr-text-main, #e3e7ec);
    padding: 6px 10px;
    font-size: 0.88rem;
    width: 100%;
    box-sizing: border-box;
}

.events-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}
.wr-help-article-body pre { display: block; padding: 10px 14px; margin-bottom: 10px; overflow-x: auto; }

/* ============================================================
   DASHBOARD GRID LAYOUT — single authoritative definition
   All card placement rules live here. Do not scatter elsewhere.
============================================================ */

/* Grid area assignments (ticker is outside the grid — lives above panel-container) */
.starship-card            { grid-area: ship; }
.location-system-card     { grid-area: location; }
.missions-card            { grid-area: missions; }
.activity-log-card        { grid-area: activity; }
.achievements-card           { grid-area: achievements; }
.tokens-card                 { grid-area: tokens; }
/* Desktop large (1200px+): 3 columns
   Row 1: ship (2 cols) | location
   Row 2: missions (2 cols) | location (spans down)
   Row 3: tokens | achievements | location
   Row 4: activity spans all 3 */
@media (min-width: 1200px) {
    .panel-container {
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-rows: auto auto auto;
        grid-template-areas:
            "ship        ship          location"
            "missions    missions      location"
            "tokens      achievements  location";
    }
    .missions-card { align-self: start; }
    .tokens-card { align-self: start; }
    .achievements-card { align-self: start; }
}

/* Tablet / laptop (768px-1199px): 2 columns */
@media (min-width: 768px) and (max-width: 1199px) {
    .panel-container {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        grid-template-areas:
            "ship        location"
            "missions    location"
            "tokens      achievements";
    }
    .missions-card { align-self: start; }
}

/* Mobile (<768px): single column, natural stack */
@media (max-width: 767px) {
    .panel-container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "ship"
            "location"
            "missions"
            "tokens"
            "achievements";
        padding: 10px;
        gap: 12px;
    }
}

/* ============================================================
   PHASE 3 — MOBILE & TABLET POLISH
============================================================ */

/* Nav strip: horizontal scroll on small screens */
.wr-nav-strip {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    flex-wrap: nowrap;
}
.wr-nav-strip::-webkit-scrollbar { display: none; }

.wr-nav-button {
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 40px;
}

/* Touch-friendly button targets on mobile */
@media (max-width: 767px) {
    .wr-nav-button {
        padding: 10px 12px;
        min-height: 44px;
        font-size: 0.75rem;
    }

    .wr-btn,
    .wr-btn-primary,
    .wr-btn-danger {
        min-height: 44px;
    }

    /* Corner nodes add no value at small size */
    .card-corner-node {
        display: none;
    }

    /* Reduce commander avatar on small screens */
    .commander-avatar {
        width: 64px;
        height: 64px;
    }

    /* Market table: horizontal scroll + hide non-essential columns */
    .wr-table-card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .wr-table-market th:nth-child(2),
    .wr-table-market td:nth-child(2) { display: none; } /* Category */
    .wr-table-market th:nth-child(6),
    .wr-table-market td:nth-child(6) { display: none; } /* Weight */
    .wr-table-market { font-size: 0.75rem; }
    .wr-table-market .market-btn { padding: 4px 6px; font-size: 0.65rem; }
    .wr-table-market input[type="number"] { width: 50px; }
}

/* Toast notification */
.mst-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1e3a5f;
    color: #e2e8f0;
    padding: 10px 20px;
    border-radius: 6px;
    border: 1px solid #2d5a8e;
    font-size: 0.85rem;
    z-index: 10000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
}
.mst-toast--show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Tablet: slightly larger touch targets than desktop */
@media (min-width: 768px) and (max-width: 1199px) {
    .wr-nav-button {
        min-height: 42px;
    }
}

/* ── Market Table ──────────────────────────────────────────────────────── */

.text-right { text-align: right !important; }

.sort-indicator {
    font-size: 0.65em;
    opacity: 0.7;
    margin-left: 2px;
}

.wr-table-market tbody tr:hover {
    cursor: default;
}

.market-actions-cell {
    white-space: nowrap;
    text-align: center;
}

.market-btn {
    padding: 3px 8px;
    font-size: 0.7rem;
    margin: 0 1px;
    min-width: unset;
    border-radius: 3px;
    border: 1px solid rgba(201,168,106,0.3);
    background: rgba(201,168,106,0.08);
    color: var(--wr-accent);
    cursor: pointer;
    transition: background 0.15s;
}

.market-btn:hover {
    background: rgba(201,168,106,0.2);
}

.wr-button-secondary.market-btn {
    border-color: rgba(100,180,255,0.3);
    background: rgba(100,180,255,0.08);
    color: var(--wr-arcane);
}

.wr-button-secondary.market-btn:hover {
    background: rgba(100,180,255,0.2);
}

.goods-icon {
    margin-right: 4px;
    font-size: 0.9em;
}

/* ══════════════════════════════════════════════════════════════════════════
   BASE BLUEPRINT — SVG schematic view
   ══════════════════════════════════════════════════════════════════════════ */

.base-blueprint {
    position: relative;
    background: rgba(0, 10, 20, 0.85);
    border: 1px solid rgba(0, 255, 255, 0.15);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    overflow: visible;
}

.bp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.bp-header-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(0, 255, 255, 0.5);
}

.bp-variant-select {
    background: rgba(0, 20, 40, 0.8);
    border: 1px solid rgba(0, 255, 255, 0.25);
    color: #a0e0ff;
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
}
.bp-variant-select:focus {
    outline: none;
    border-color: rgba(0, 255, 255, 0.5);
}

.base-blueprint svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Hull structure lines */
.bp-hull-line {
    fill: none;
    stroke: rgba(0, 255, 255, 0.12);
    stroke-width: 1.5;
}

.bp-hull-line--inner {
    stroke: rgba(0, 255, 255, 0.08);
    stroke-width: 1;
    stroke-dasharray: 4 3;
}

/* Core node (center of base) */
.bp-core {
    fill: rgba(0, 255, 255, 0.06);
    stroke: rgba(0, 255, 255, 0.25);
    stroke-width: 1.5;
}

/* Slot groups */
.bp-slot {
    cursor: pointer;
    transition: filter 0.2s;
}
.bp-slot:hover {
    filter: brightness(1.3);
}

/* Hexagon shapes */
.bp-slot-hex {
    stroke-width: 1.5;
    transition: fill 0.2s, stroke 0.2s;
}

.bp-slot-hex--empty {
    fill: rgba(0, 255, 255, 0.03);
    stroke: rgba(0, 255, 255, 0.2);
    stroke-dasharray: 4 3;
}
.bp-slot:hover .bp-slot-hex--empty {
    fill: rgba(0, 255, 255, 0.08);
    stroke: rgba(0, 255, 255, 0.4);
}

/* Category colours — occupied slots */
.bp-slot-hex--utility   { fill: rgba(59, 130, 246, 0.2);  stroke: #3b82f6; }
.bp-slot-hex--storage   { fill: rgba(245, 158, 11, 0.2);  stroke: #f59e0b; }
.bp-slot-hex--production{ fill: rgba(16, 185, 129, 0.2);  stroke: #10b981; }
.bp-slot-hex--market    { fill: rgba(139, 92, 246, 0.2);  stroke: #8b5cf6; }

/* Glow filter for active modules */
.bp-slot--active .bp-slot-hex {
    filter: drop-shadow(0 0 4px currentColor);
}

/* Status animations */
.bp-slot--building .bp-slot-hex {
    animation: bp-pulse-orange 1.5s ease-in-out infinite;
}
.bp-slot--damaged .bp-slot-hex {
    animation: bp-pulse-red 1s ease-in-out infinite;
}
.bp-slot--offline .bp-slot-hex {
    opacity: 0.35;
}

@keyframes bp-pulse-orange {
    0%, 100% { stroke: #f59e0b; filter: drop-shadow(0 0 3px rgba(245,158,11,0.4)); }
    50%      { stroke: #fbbf24; filter: drop-shadow(0 0 8px rgba(245,158,11,0.7)); }
}
@keyframes bp-pulse-red {
    0%, 100% { stroke: #ef4444; filter: drop-shadow(0 0 3px rgba(239,68,68,0.4)); }
    50%      { stroke: #f87171; filter: drop-shadow(0 0 8px rgba(239,68,68,0.7)); }
}

/* Module icon inside hex */
.bp-slot-icon {
    fill: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

/* Empty slot "+" icon */
.bp-slot-plus {
    fill: rgba(0, 255, 255, 0.3);
    font-size: 16px;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

/* Level badge */
.bp-slot-level {
    font-size: 8px;
    fill: #fff;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}
.bp-slot-level-bg {
    fill: rgba(0, 0, 0, 0.6);
    stroke: rgba(255, 255, 255, 0.3);
    stroke-width: 0.5;
}

/* Construction progress arc */
.bp-progress-arc {
    fill: none;
    stroke: #f59e0b;
    stroke-width: 2;
    stroke-linecap: round;
}

/* Power flow lines */
.bp-power-line {
    fill: none;
    stroke: rgba(34, 211, 238, 0.3);
    stroke-width: 1;
    stroke-dasharray: 6 4;
    animation: bp-power-flow 1.5s linear infinite;
}

@keyframes bp-power-flow {
    from { stroke-dashoffset: 0; }
    to   { stroke-dashoffset: -20; }
}

/* Slot number label (subtle) */
.bp-slot-num {
    font-size: 7px;
    fill: rgba(255, 255, 255, 0.2);
    text-anchor: middle;
    pointer-events: none;
}

/* ── Blueprint Popover ─────────────────────────────────────────────────── */

.bp-popover {
    position: absolute;
    z-index: 100;
    background: rgba(10, 20, 30, 0.95);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 6px;
    padding: 12px;
    min-width: 200px;
    max-width: 260px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    pointer-events: auto;
}

.bp-popover-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e0f0ff;
    margin-bottom: 6px;
}

.bp-popover-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    opacity: 0.7;
}

.bp-popover-stat {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 3px;
}
.bp-popover-stat strong {
    color: rgba(255, 255, 255, 0.85);
}

.bp-popover-actions {
    margin-top: 10px;
    display: flex;
    gap: 6px;
}

.bp-popover-btn {
    padding: 4px 10px;
    font-size: 0.7rem;
    border: 1px solid rgba(0, 255, 255, 0.3);
    background: rgba(0, 255, 255, 0.08);
    color: #a0e0ff;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}
.bp-popover-btn:hover {
    background: rgba(0, 255, 255, 0.18);
}
.bp-popover-btn--danger {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
    color: #fca5a5;
}
.bp-popover-btn--danger:hover {
    background: rgba(239, 68, 68, 0.18);
}

.bp-popover-close {
    position: absolute;
    top: 4px;
    right: 8px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    cursor: pointer;
    padding: 2px;
}
.bp-popover-close:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* ── Blueprint Legend ──────────────────────────────────────────────────── */

.bp-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 255, 255, 0.08);
}

.bp-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.45);
}

.bp-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

/* ============================================================
   BASE EVENTS
   ============================================================ */
.bases-events-section { margin-top: 12px; }
.base-events-badge {
    display: inline-block;
    background: #f44336;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 6px;
    margin-left: 6px;
    vertical-align: middle;
}
.base-events-list { margin-top: 6px; }
.base-event-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 8px;
}
.base-event-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.base-event-icon { font-size: 14px; }
.base-event-label { font-size: 12px; font-weight: 600; flex: 1; }
.base-event-ttl { font-size: 10px; color: var(--wr-text-muted); white-space: nowrap; }
.base-event-desc { font-size: 11px; color: var(--wr-text-muted); margin-bottom: 6px; }
.base-event-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Black market banner */
.bases-bm-banner { margin-bottom: 8px; }
.bases-bm-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(76,175,80,0.12);
    border: 1px solid rgba(76,175,80,0.3);
    color: #4caf50;
}
.bases-bm-suspended {
    background: rgba(244,67,54,0.12);
    border-color: rgba(244,67,54,0.3);
    color: #f44336;
}

/* Base profile (description / specialisation tag) */
.base-profile-desc {
    font-size: 12px;
    color: var(--wr-text-muted);
    font-style: italic;
    margin-bottom: 4px;
    line-height: 1.4;
}
.base-profile-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(100,181,246,0.15);
    border: 1px solid rgba(100,181,246,0.3);
    color: #64b5f6;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
/* Base changelog (recent activity) */
.base-changelog-list {
    margin-top: 4px;
    max-height: 260px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.base-changelog-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.base-changelog-row:last-child { border-bottom: none; }
.base-changelog-icon { font-size: 13px; flex-shrink: 0; line-height: 1.3; }
.base-changelog-desc {
    font-size: 11px;
    color: var(--wr-text-muted, #888);
    flex: 1;
    line-height: 1.35;
}
.base-changelog-tick {
    font-size: 10px;
    color: #555;
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: 1px;
}

/* ── Subscription Tier Badges ────────────────────────────── */
.tier-badge {
    display: inline-block;
    font-size: .6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: .06em;
    vertical-align: middle;
    margin-left: 5px;
    text-decoration: none;
    line-height: 1.6;
}

/* Header store CTA */
.mst-header-store {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    background: rgba(255,255,255,0.06);
    color: var(--wr-text-soft);
    border: 1px solid var(--wr-border);
    transition: background 0.2s, border-color 0.2s;
}
.mst-header-store:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--wr-border-soft);
    color: var(--wr-text);
}
.mst-header-store--upgrade {
    background: linear-gradient(135deg, #78350f, #92400e);
    color: #fcd34d;
    border: 1px solid #a16207;
    animation: store-glow 3s ease-in-out infinite;
}
.mst-header-store--upgrade:hover {
    background: linear-gradient(135deg, #92400e, #a16207);
    color: #fef3c7;
    border-color: #ca8a04;
}
@keyframes store-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(252,211,77,0); }
    50% { box-shadow: 0 0 8px 1px rgba(252,211,77,0.15); }
}
.tier-badge--free      { background: #1e293b; color: #64748b; border: 1px solid #334155; }
.tier-badge--commander { background: #78350f; color: #fcd34d; }
.tier-badge--admiral   { background: #1e3a5f; color: #93c5fd; }

/* Leaderboards panel */
.lb-categories {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--wr-border);
    overflow-x: auto;
}
.lb-cat {
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255,255,255,0.04);
    color: var(--wr-text-muted);
    border: 1px solid var(--wr-border);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.lb-cat:hover {
    background: rgba(255,255,255,0.08);
    color: var(--wr-text);
}
.lb-cat.active {
    background: rgba(201,168,106,0.15);
    color: var(--wr-accent);
    border-color: var(--wr-accent);
}
.lb-boards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    padding: 16px;
}
.lb-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--wr-border);
    border-radius: 6px;
    overflow: hidden;
}
.lb-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--wr-border);
    background: rgba(255,255,255,0.02);
}
.lb-card-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--wr-accent);
}
.lb-card-metric {
    font-size: 0.6rem;
    color: var(--wr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.lb-table {
    width: 100%;
    border-collapse: collapse;
}
.lb-row td {
    padding: 6px 14px;
    font-size: 0.78rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.lb-row:last-child td { border-bottom: none; }
.lb-rank {
    width: 36px;
    text-align: center;
    font-weight: 700;
    color: var(--wr-text-muted);
    white-space: nowrap;
}
.lb-rank-1 { color: #fcd34d; }
.lb-rank-2 { color: #94a3b8; }
.lb-rank-3 { color: #d97706; }
.lb-medal { font-size: 0.7rem; }
.lb-name {
    color: var(--wr-text);
    font-weight: 500;
}
.lb-extra {
    display: block;
    font-size: 0.65rem;
    color: var(--wr-text-muted);
    font-weight: 400;
}
.lb-value {
    text-align: right;
    color: var(--wr-text-soft);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.lb-self td {
    background: rgba(201,168,106,0.08);
}
.lb-self .lb-name {
    color: var(--wr-accent);
}
.lb-empty {
    padding: 24px 14px;
    text-align: center;
    color: var(--wr-text-muted);
    font-size: 0.75rem;
}

/* Upsell modal */
.tier-upsell-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.65);
    display: flex; align-items: center; justify-content: center;
    z-index: 9000;
}
.tier-upsell-box {
    background: #111827;
    border: 1px solid #1e40af;
    border-radius: 10px;
    padding: 2rem 2.5rem;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,.6);
}
.tier-upsell-box h3 { margin: 0 0 .75rem; color: #c8d8e8; font-size: 1.1rem; }
.tier-upsell-box p  { margin: 0 0 1.25rem; color: #94a3b8; font-size: .9rem; line-height: 1.5; }
.tier-upsell-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }
.tier-upsell-actions a.btn-upgrade {
    background: #1d4ed8;
    color: #fff;
    padding: 8px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
}
.tier-upsell-actions a.btn-upgrade:hover { background: #2563eb; }
.tier-upsell-actions button.btn-dismiss {
    background: transparent;
    border: 1px solid #334155;
    color: #94a3b8;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: .85rem;
}

/* Subscribe / Billing pages */
.subscribe-plans { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; margin: 1.5rem 0; }
.subscribe-plan-card {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 10px;
    padding: 1.5rem;
    width: 200px;
    text-align: center;
}
.subscribe-plan-card.plan-current { border-color: #1d4ed8; }
.subscribe-plan-card.plan-admiral  { border-color: #1e40af; }
.subscribe-plan-price { font-size: 1.6rem; font-weight: 700; color: #c8d8e8; margin: .5rem 0; }
.subscribe-plan-price span { font-size: .75rem; color: #64748b; font-weight: 400; }
.subscribe-plan-features { list-style: none; padding: 0; margin: 1rem 0; text-align: left; }
.subscribe-plan-features li { color: #94a3b8; font-size: .82rem; padding: 3px 0; }
.subscribe-plan-features li::before { content: "✓ "; color: #22c55e; }
.subscribe-plan-btn {
    display: block;
    background: #1d4ed8;
    color: #fff;
    padding: 9px;
    border-radius: 5px;
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
    margin-top: 1rem;
    cursor: pointer;
    border: none;
    width: 100%;
}
.subscribe-plan-btn:hover { background: #2563eb; }
.subscribe-plan-btn.btn-current { background: #1e293b; color: #64748b; cursor: default; }
.billing-table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: .85rem; }
.billing-table th { color: #64748b; text-align: left; padding: 6px 8px; border-bottom: 1px solid #1e293b; }
.billing-table td { color: #94a3b8; padding: 6px 8px; border-bottom: 1px solid #0f172a; }

/* ── Shop Page ─────────────────────────────────────────── */
.shop-success { background: rgba(16,185,129,.15); border: 1px solid #065f46; padding: 10px 14px; border-radius: 6px; color: #6ee7b7; margin-bottom: 1rem; font-size: .9rem; text-align: center; }
.shop-section { margin-bottom: 2rem; }
.shop-section-title { color: #c8d8e8; font-size: 1rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin-bottom: .8rem; padding-bottom: .4rem; border-bottom: 1px solid #1e293b; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.shop-card { background: #0f172a; border: 1px solid #1e293b; border-radius: 8px; padding: 1rem; text-align: center; transition: border-color .2s; }
.shop-card:hover { border-color: #334155; }
.shop-card--credit { border-left: 3px solid #fcd34d; }
.shop-card--upgrade { border-left: 3px solid #38bdf8; }
.shop-card--boost { border-left: 3px solid #a78bfa; }
.shop-card--capped { opacity: .5; }
.shop-card-name { font-size: .95rem; font-weight: 600; color: #c8d8e8; margin-bottom: .3rem; }
.shop-card-desc { font-size: .8rem; color: #64748b; margin-bottom: .5rem; }
.shop-card-value { font-size: 1.1rem; font-weight: 700; color: #fcd34d; margin-bottom: .3rem; }
.shop-card-price { font-size: 1.2rem; font-weight: 700; color: #e2e8f0; margin-bottom: .6rem; }
.shop-card-btn { display: block; background: #1d4ed8; color: #fff; padding: 8px; border-radius: 5px; text-decoration: none; font-size: .85rem; font-weight: 600; cursor: pointer; border: none; width: 100%; }
.shop-card-btn:hover { background: #2563eb; }
.shop-card-btn--disabled { display: block; background: #1e293b; color: #64748b; padding: 8px; border-radius: 5px; font-size: .85rem; font-weight: 600; cursor: default; text-align: center; }
.shop-build-targets { margin-top: .6rem; text-align: left; }
.shop-build-label { font-size: .75rem; color: #64748b; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .3rem; }
.shop-instant-btn { background: #312e81; color: #c4b5fd; border: 1px solid #4338ca; border-radius: 4px; padding: 5px 10px; font-size: .8rem; cursor: pointer; transition: background .2s; }
.shop-instant-btn:hover { background: #4338ca; color: #fff; }
.instant-btn { display: inline-block; background: #312e81; color: #c4b5fd; border: 1px solid #4338ca; border-radius: 4px; padding: 3px 8px; font-size: .75rem; cursor: pointer; text-decoration: none; margin-top: .3rem; transition: background .2s; }
.instant-btn:hover { background: #4338ca; color: #fff; }

/* ── Cookie Notice ─────────────────────────────────────── */
.cookie-notice {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
    background: #0f172a; border-top: 1px solid #1e293b;
    padding: .75rem 1.5rem; display: flex; align-items: center;
    justify-content: space-between; gap: 1rem;
    font-size: .8rem; color: #94a3b8;
}
.cookie-notice-btn {
    background: #1e3a5f; border: 1px solid #2d5a8e; color: #93c5fd;
    padding: 4px 14px; border-radius: 4px; cursor: pointer;
    white-space: nowrap; font-size: .8rem; flex-shrink: 0;
}
.cookie-notice-btn:hover { background: #1e4a7f; }
@media (max-width: 600px) {
    .cookie-notice { flex-direction: column; align-items: flex-start; }
}

/* ── Player Faction Assault ────────────────────────────────── */
.assault-status-card {
    border-left: 3px solid #CC0000;
}
.assault-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    margin-left: 0.35rem;
    white-space: nowrap;
    vertical-align: middle;
}
.assault-badge--rallying {
    background: rgba(230, 126, 34, 0.2);
    color: #E67E22;
    border: 1px solid rgba(230, 126, 34, 0.4);
    animation: assault-pulse-amber 2s ease-in-out infinite;
}
.assault-badge--active {
    background: rgba(204, 0, 0, 0.2);
    color: #CC0000;
    border: 1px solid rgba(204, 0, 0, 0.4);
    animation: assault-pulse-red 1.5s ease-in-out infinite;
}
.assault-badge--won {
    background: rgba(39, 174, 96, 0.2);
    color: #27AE60;
    border: 1px solid rgba(39, 174, 96, 0.4);
}
.assault-badge--failed {
    background: rgba(127, 140, 141, 0.2);
    color: #7f8c8d;
    border: 1px solid rgba(127, 140, 141, 0.4);
}
@keyframes assault-pulse-amber {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
@keyframes assault-pulse-red {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px rgba(204, 0, 0, 0.3); }
    50% { opacity: 0.6; box-shadow: 0 0 8px rgba(204, 0, 0, 0.5); }
}
.assault-combat-banner {
    background: rgba(204, 0, 0, 0.15);
    border: 1px solid rgba(204, 0, 0, 0.4);
    color: #CC0000;
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    margin: 0.5rem 0;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* ── Planet Specialisation + Events ── */
.planet-spec-badge {
    color: #8ab4f8;
    font-weight: 500;
}
.planet-event-indicator {
    font-size: 0.8rem;
    margin-top: 2px;
    font-weight: 500;
}
.planet-info-specialisation {
    font-size: 0.85rem;
    color: #8ab4f8;
    margin-top: 2px;
    font-weight: 500;
}
.planet-event-box {
    margin-top: 0.75rem;
    padding: 0.6rem 0.8rem;
    border: 1px solid;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
}
.planet-event-box-label {
    font-weight: 600;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 2px;
}
.planet-event-box-desc {
    font-size: 0.8rem;
    color: var(--wr-text-soft, #888);
    display: block;
}
.planet-event-box-timer {
    font-size: 0.75rem;
    color: var(--wr-text-soft, #666);
    display: block;
    margin-top: 4px;
}


/* ============================================================ */
/* ACHIEVEMENTS & BADGES                                         */
/* ============================================================ */

.ach-filter-btn {
    padding: 4px 12px;
    font-size: 0.8rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--wr-border, rgba(255,255,255,0.1));
    border-radius: 4px;
    color: var(--wr-text-soft);
    cursor: pointer;
    transition: all 0.2s;
}
.ach-filter-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--wr-text);
}
.ach-filter-btn.active {
    background: var(--wr-accent, #4a9eff);
    border-color: var(--wr-accent, #4a9eff);
    color: #fff;
}

.ach-category {
    margin-bottom: 1.5rem;
}
.ach-category-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--wr-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

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

.ach-item {
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    transition: background 0.2s;
}
.ach-item:hover {
    background: rgba(255,255,255,0.06);
}
.ach-item--locked {
    opacity: 0.7;
}
.ach-item--unlocked {
    opacity: 1;
}

.ach-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}
.ach-item-tier {
    font-size: 1.1rem;
}
.ach-item-name {
    font-weight: 600;
    color: var(--wr-text);
    font-size: 0.9rem;
}
.ach-item-check {
    margin-left: auto;
    color: #4caf50;
    font-weight: bold;
    font-size: 1rem;
}

.ach-item-desc {
    color: var(--wr-text-soft);
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.ach-item-date {
    font-size: 0.75rem;
    color: var(--wr-text-soft);
    opacity: 0.7;
}

.ach-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.35rem;
}
.ach-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(0,0,0,0.3);
    border-radius: 3px;
    overflow: hidden;
}
.ach-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}
.ach-progress-text {
    font-size: 0.75rem;
    color: var(--wr-text-soft);
    white-space: nowrap;
}

/* Badge slots */
.ach-badge-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 70px;
    border-radius: 8px;
    font-size: 0.75rem;
    text-align: center;
    gap: 0.25rem;
}
.ach-badge-slot--filled {
    background: rgba(255,215,0,0.08);
    border: 1px solid rgba(255,215,0,0.3);
}
.ach-badge-slot--empty {
    background: rgba(255,255,255,0.03);
    border: 1px dashed rgba(255,255,255,0.15);
    color: var(--wr-text-soft);
}
.ach-badge-icon {
    font-size: 1.5rem;
}
.ach-badge-name {
    color: var(--wr-text);
    font-size: 0.7rem;
    line-height: 1.2;
}

.ach-badge-earned {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 3px 8px;
    background: rgba(255,215,0,0.08);
    border: 1px solid rgba(255,215,0,0.2);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--wr-text);
}

.ach-badge-picker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-size: 0.85rem;
    color: var(--wr-text);
}

/* Roster V2 — Group containers */
.roster-group {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    margin-bottom: 8px;
    overflow: hidden;
}
.roster-group.collapsed .roster-group-body { display: none; }
.roster-group.collapsed .roster-chevron { transform: rotate(-90deg); }
.roster-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    background: rgba(255,255,255,0.04);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.roster-group-header:hover { background: rgba(255,255,255,0.06); }
.roster-chevron {
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    transition: transform 0.15s;
}
.roster-group-body {
    padding: 6px 8px;
}

/* Roster V2 — NPC row */
.roster-npc-row {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 5px;
    padding: 8px 10px;
    margin-bottom: 4px;
}
.roster-npc-row:hover {
    background: rgba(255,255,255,0.05);
}
.roster-npc-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 3px;
}
.roster-npc-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--wr-text-main, #e0e0e0);
    cursor: pointer;
    text-decoration: none;
}
.roster-npc-name:hover {
    color: #7ec8ff;
    text-decoration: underline;
}
.roster-npc-stats {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: rgba(255,255,255,0.55);
}
.roster-npc-location {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    margin-bottom: 4px;
}
.roster-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 4px;
}
.roster-inline-select {
    font-size: 11px !important;
    padding: 2px 6px !important;
    max-width: 140px;
}
.roster-checkbox-label {
    margin-left: auto;
    cursor: pointer;
}
.roster-bulk-cb {
    cursor: pointer;
    accent-color: #7ec8ff;
}

/* Roster V2 — Bulk bar */
#roster-bulk-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #333;
    margin-bottom: 6px;
}

/* Roster V2 — NPC Detail Modal */
.roster-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.65);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.roster-modal {
    background: #1a1d24;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    width: 420px;
    max-width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.roster-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.roster-modal-header h3 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.roster-modal-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
}
.roster-modal-close:hover { color: #fff; }
.roster-modal-body {
    padding: 14px 18px;
}
.roster-detail-grid {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 6px 12px;
    font-size: 13px;
    margin-bottom: 16px;
}
.roster-detail-label {
    color: rgba(255,255,255,0.45);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.roster-detail-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
    padding: 12px 0;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.roster-stat-block {
    text-align: center;
    min-width: 60px;
}
.roster-stat-val {
    font-size: 22px;
    font-weight: 700;
    color: #7ec8ff;
}
.roster-stat-label {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.roster-xp-bar {
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}
.roster-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a90d9, #7ec8ff);
    border-radius: 3px;
    transition: width 0.3s;
}

/* Combat log hit/miss styling */
.combat-log-hit { color: #4ade80; }
.combat-log-miss { color: #94a3b8; font-style: italic; }
.combat-log-critical { color: #f87171; font-weight: bold; }
.combat-log-brace { color: #60a5fa; }

/* Threat level badges */
.combat-threat-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
    margin-left: 4px;
}
.combat-threat-rookie { background: #334155; color: #94a3b8; }
.combat-threat-seasoned { background: #1e3a5f; color: #60a5fa; }
.combat-threat-veteran { background: #3f2f00; color: #fbbf24; }
.combat-threat-elite { background: #4a1d00; color: #fb923c; }
.combat-threat-legendary { background: #4a0519; color: #f43f5e; }
/* Narrative flavour text */
.bar-atmosphere {
    font-style: italic;
    color: var(--wr-text-muted, #888);
    padding: 8px 12px;
    margin: 0 0 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 0.9em;
    line-height: 1.5;
}
.npc-quote {
    font-style: italic;
    color: var(--wr-text-muted, #999);
    font-size: 0.82em;
    padding: 6px 0 2px;
    line-height: 1.4;
}

/* Travel narration + crew chatter */
.travel-narrative {
    font-style: italic;
    color: var(--wr-text-muted, #888);
    margin-top: 10px;
    font-size: 0.88em;
    line-height: 1.5;
}
.crew-chatter {
    color: var(--wr-accent, #4fc3f7);
    font-size: 0.85em;
    margin-top: 6px;
    padding-left: 8px;
    border-left: 2px solid var(--wr-accent, #4fc3f7);
}

/* Dock micro-events */
.dock-event-desc {
    color: #ccc;
    margin: 10px 0 16px;
    line-height: 1.6;
    font-size: 0.92em;
}
.dock-event-outcome {
    color: var(--wr-accent, #4fc3f7);
    margin: 12px 0;
    font-style: italic;
    line-height: 1.5;
}

/* ===== PHASE 1: Rank Badges ===== */
.rank-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
    line-height: 1.3;
}
.rank-badge--0 { background: #374151; color: #9ca3af; }
.rank-badge--1 { background: #1e3a5f; color: #60a5fa; }
.rank-badge--2 { background: #2d1b69; color: #a78bfa; }
.rank-badge--3 { background: #713f12; color: #fbbf24; }
.rank-badge--4 { background: #4a1d96; color: #c4b5fd; }
.rank-badge--5 { background: #7c2d12; color: #fb923c; border: 1px solid #fb923c; }

/* ===== PHASE 1: Ship Role Tags ===== */
.role-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 1px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    vertical-align: middle;
}
.role-tag--combat { background: #4a0519; color: #f43f5e; }
.role-tag--trader { background: #164e63; color: #22d3ee; }
.role-tag--miner { background: #3f2f00; color: #fbbf24; }
.role-tag--harvester { background: #14532d; color: #4ade80; }
.role-tag--scout { background: #312e81; color: #818cf8; }
.role-tag--hybrid { background: #374151; color: #9ca3af; }

/* ===== PHASE 1: Station Bonus Banner ===== */
.station-bonus-banner {
    background: rgba(79, 195, 247, 0.08);
    border: 1px solid rgba(79, 195, 247, 0.2);
    border-radius: 6px;
    padding: 6px 12px;
    margin-bottom: 12px;
    font-size: 0.78rem;
    color: var(--wr-accent, #4fc3f7);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ===== PHASE 1: Faction Perk Badges ===== */
.perk-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.8rem;
}
.perk-item--locked { opacity: 0.4; }
.perk-item--unlocked { color: #4ade80; }
.perk-threshold {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
    min-width: 50px;
}

/* ===== PHASE 1: Mission Chain UI ===== */
.chain-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}
.chain-card--active { border-color: rgba(79,195,247,0.3); }
.chain-card--completed { border-color: rgba(74,222,128,0.3); opacity: 0.7; }
.chain-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.chain-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #e0e0e0;
}
.chain-type-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}
.chain-type--trade { background: #164e63; color: #22d3ee; }
.chain-type--combat { background: #4a0519; color: #f43f5e; }
.chain-type--exploration { background: #312e81; color: #818cf8; }
.chain-type--mixed { background: #374151; color: #9ca3af; }
.chain-progress {
    display: flex;
    gap: 4px;
    margin: 8px 0;
}
.chain-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
}
.chain-dot--done { background: #4ade80; border-color: #4ade80; }
.chain-dot--current { background: var(--wr-accent, #4fc3f7); border-color: var(--wr-accent); }
.chain-desc {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.4;
    margin-bottom: 6px;
}
.chain-reward {
    font-size: 0.72rem;
    color: #fbbf24;
}

/* ===== PHASE 1: Event Escalation Badge ===== */
.event-escalating {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 2px;
    background: #7c2d12;
    color: #fb923c;
    animation: pulse-escalate 2s infinite;
    margin-left: 4px;
}
@keyframes pulse-escalate {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Promotion available — amber pulse on XP bar */
@keyframes promotion-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px rgba(245,158,11,0.3); }
    50% { opacity: 0.7; box-shadow: 0 0 12px rgba(245,158,11,0.6); }
}

/* Discovery announcement — gold ticker tag */
.ticker-type-tag--discovery {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: #000 !important;
    font-weight: 700;
}
