#inv-cargo-grid,
#inv-wh-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 6rem), 1fr));
    gap: 15px;
    overflow: visible;
    margin: var(--space-md);
}

#inv-cargo-grid .sp-hold-slot-name,
#inv-wh-grid .sp-hold-slot-name {
    display: none;
}

#inv-cargo-grid .sp-hold-slot:not(.sp-hold-slot--empty),
#inv-wh-grid .sp-hold-slot:not(.sp-hold-slot--empty) {
    cursor: pointer;
}

.inv-two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-lg);
    align-items: stretch;
}

.inv-two-col > .rp-section {
    min-width: 0;
}

.inv-grid-clip {
    box-sizing: border-box;
    overflow: visible;
    background: rgba(197, 160, 89, 0.02);
    border: 1px solid rgba(197, 160, 89, 0.1);
    border-radius: 4px;
    position: relative;
    min-width: 0;
    width: 100%;
    --inv-section-control-h: 34px;
}

.inv-section-head {
    position: relative;
    padding: 12px 14px 0;
    border-bottom: none;
    min-width: 0;
}

.inv-section-head__labels {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: 8px;
    padding: 0;
}

.inv-section-head__eyebrow {
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(197, 160, 89, 0.72);
}

.inv-section-head__eyebrow--metric {
    text-align: right;
}

.inv-section-head__controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    min-width: 0;
}

.inv-section-head__selector {
    flex: 1 1 auto;
    min-width: 0;
    height: var(--inv-section-control-h);
    overflow: visible;
}

.inv-section-head__selector .inv-section-select-wrap,
.inv-section-head__selector .inv-section-select--static {
    height: 100%;
}

.inv-section-head__metric {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    height: var(--inv-section-control-h);
}

.inv-section-head__metric-box {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    height: var(--inv-section-control-h);
    min-width: 0;
    padding: 0 8px 0 10px;
    border: 1px solid rgba(197, 160, 89, 0.22);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.22);
}

.inv-section-head__metric-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
    height: 16px;
}

.inv-section-head__metric-icon {
    flex-shrink: 0;
    display: block;
    width: 16px;
    height: 16px;
}

.inv-section-head__metric-icon--img {
    object-fit: contain;
    opacity: 0.85;
}

.inv-section-head__metric-value {
    display: flex;
    align-items: center;
    font-size: var(--font-size-sm);
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
    height: 16px;
    color: var(--gold);
    white-space: nowrap;
    min-width: 0;
}

.inv-section-head__metric-value--warn {
    color: #e8a8a8;
}

.inv-section-head__bar.svc-hp-bar {
    position: relative;
    z-index: 0;
    height: 7px;
    margin: 0 -14px;
    border-radius: 0;
}

.inv-section-head__bar .svc-hp-fill {
    border-radius: 0;
}

.inv-section-head__fill--storage {
    background: linear-gradient(90deg, rgba(197, 160, 89, 0.85), rgba(224, 192, 96, 0.95));
}

.inv-section-head__fill--storage.svc-hp-fill--low {
    background: linear-gradient(90deg, #e07070, #c54a4a);
}

.inv-section-head__fill--storage.svc-hp-fill--mid {
    background: linear-gradient(90deg, #e0a840, #c59030);
}

.inv-section-select-wrap {
    position: relative;
    min-width: 0;
    height: 100%;
    z-index: 1;
}

.inv-section-select-wrap:has(.inv-section-select--open) {
    z-index: 60;
}

.inv-section-select,
.inv-section-select--static {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    height: var(--inv-section-control-h);
    padding: 0 10px;
    border: 1px solid rgba(197, 160, 89, 0.22);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.22);
    color: var(--gold);
    font-family: var(--font-body);
    font-size: var(--font-size-sm);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1;
}

.inv-section-select {
    cursor: pointer;
    transition:
        border-color 0.15s,
        background 0.15s;
}

.inv-section-select--static {
    cursor: default;
}

.inv-section-select:hover {
    border-color: rgba(197, 160, 89, 0.38);
    background: rgba(197, 160, 89, 0.05);
}

.inv-section-select__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inv-section-select__chevron {
    flex-shrink: 0;
    color: var(--gold);
    opacity: 0.75;
    transition: transform 0.15s ease;
}

.inv-section-select--open .inv-section-select__chevron {
    transform: rotate(180deg);
}

.inv-section-select__menu {
    left: 0;
    right: 0;
    min-width: 100%;
}

.inv-section-expand-btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 22px;
    margin: 0;
    padding: 0 10px;
    border: 1px solid rgba(197, 160, 89, 0.35);
    border-radius: 4px;
    background: transparent;
    color: var(--gold);
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    transition:
        border-color 0.15s,
        background 0.15s;
}

.inv-section-expand-btn:hover {
    border-color: rgba(197, 160, 89, 0.55);
    background: rgba(197, 160, 89, 0.08);
}

#inv-wh-grid > *,
#inv-cargo-grid > * {
    box-sizing: border-box;
    min-width: 0;
    overflow: visible;
}

.inv-grid-clip .inv-section-head + .sp-hold-grid,
.inv-grid-clip .inv-section-head + .inv-loading-notice,
.inv-grid-clip .inv-section-head ~ .sp-hold-grid {
    margin-top: 0;
}

/* Legacy header overrides kept for guild storage clip reuse */
.inv-grid-clip .rp-orders-header {
    height: 32px;
    align-items: start;
    margin: var(--space-md);
}

.inv-grid-clip .svc-hp-bar:not(.inv-section-head__bar) {
    margin: var(--space-md);
}

.inv-grid-clip .rp-orders-header .cp-add-btn {
    margin-top: -5px;
}

.inv-undocked-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    position: sticky;
    bottom: 0;
    font-size: var(--font-size-sm);
    line-height: 1.4;
    color: var(--text-muted);
    text-align: center;
    pointer-events: none;
}

.inv-undocked-notice img {
    flex-shrink: 0;
    display: block;
}

/* ── Loading skeleton (data not yet landed - distinct from a real empty grid) ── */

.inv-slot-skeleton {
    pointer-events: none;
    gap: 6px;
}

.inv-slot-skeleton-icon {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 6px;
    background: var(--surface-inset);
    animation: inv-skeleton-pulse 1.4s ease-in-out infinite;
}

.inv-slot-skeleton-line {
    width: 60%;
    height: 0.6rem;
    border-radius: 3px;
    background: var(--surface-inset);
    animation: inv-skeleton-pulse 1.4s ease-in-out infinite;
}

@keyframes inv-skeleton-pulse {
    0%,
    100% {
        opacity: 0.45;
    }
    50% {
        opacity: 1;
    }
}

.inv-loading-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: var(--space-sm);
    font-size: var(--font-size-sm);
    line-height: 1.4;
    color: var(--text-muted);
    text-align: center;
    pointer-events: none;
}

/* ── City storage dropdown (legacy ship selector list) ──── */

.inv-city-dropdown {
    position: relative;
}

.inv-city-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: none;
    padding: 0 0 10px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: var(--font-size-md);
    font-weight: bold;
    color: var(--gold);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    line-height: 1.2;
}

.inv-city-btn:hover {
    color: var(--gold);
    opacity: 0.8;
}

.inv-city-chevron {
    color: var(--gold);
    opacity: 0.7;
    flex-shrink: 0;
    transition: transform 0.15s ease;
    margin-bottom: 2px;
}

.inv-city-btn--open .inv-city-chevron {
    transform: rotate(180deg);
}

.inv-city-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 50;
    min-width: 160px;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: var(--bg-panel, #0e1117);
    border: 1px solid rgba(197, 160, 89, 0.25);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

.inv-city-option {
    padding: 8px 14px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition:
        background 0.1s,
        color 0.1s;
}

.inv-city-option:hover {
    background: rgba(197, 160, 89, 0.07);
    color: var(--text-primary);
}

.inv-city-option--active {
    color: var(--color-gold);
    font-weight: 600;
}

.mkt-history-filter-group {
    margin-top: var(--space-sm);
}

#inventory-panel .inv-filter-chips--skill .mkt-cat-btn:has(.mkt-cat-icon) {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    height: 30px;
    padding: 0;
}

#inventory-panel .inv-filter-chips--skill .mkt-cat-btn:not(:has(.mkt-cat-icon)) {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    padding: 0 14px;
}

#inventory-panel .inv-filter-chips--skill .mkt-cat-icon {
    margin-right: 0;
    flex-shrink: 0;
}

#inventory-panel .inv-filter-chips--sort .mkt-cat-btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 0;
    max-width: none;
    height: 30px;
    padding: 0 14px;
}

/* Ship / port tab toggle — single-column inventory below xl (see responsive.css) */
.inv-mobile-tabs {
    display: none;
    margin-bottom: var(--space-md);
}

@media (max-width: 1279px) {
    .inv-mobile-tabs {
        display: block;
    }

    .inv-mobile-tabs .bl-tab-toggle__btn {
        width: 49%;
    }

    .inv-mobile-hidden {
        display: none;
    }
}
