.inventory-shell {
    max-width: min(1680px, calc(100vw - 32px));
    padding: 88px 24px 130px; /* bottom clears the sticky contract tray */
    position: relative;
    isolation: isolate;
}
/* Subtle scrim so the teal body gradient reads darker behind white cards */
.inventory-shell::before {
    content: "";
    position: absolute;
    inset: 64px 0 0;
    background: rgba(0, 0, 0, 0.08);
    pointer-events: none;
    z-index: -1;
    border-radius: 8px;
}

/* ============================================================
   Inventory page Phase 4 redesign — color-coded rarity pills,
   wear pills, sticky bottom contract tray. The grid card styles
   inherited from Stage A above stay compact.
   ============================================================ */
:root {
    --border-color: var(--border-light);
    --rarity-consumer:   #b0c3d9;
    --rarity-industrial: #5e98d9;
    --rarity-milspec:    #4b69ff;
    --rarity-restricted: #8847ff;
    --rarity-classified: #d32ce6;
    --rarity-covert:     #eb4b4b;
}

.inventory-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.inventory-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #f4f7fa;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.inventory-header p {
    margin: 6px 0 0;
    color: rgba(244, 247, 250, 0.85);
    font-size: 13px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.inventory-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: flex-end;
}

.inventory-source-control {
    display: grid;
    gap: 5px;
    min-width: 132px;
    color: #f4f7fa;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.inventory-refresh-control {
    display: grid;
    gap: 5px;
    min-width: 168px;
    max-width: 250px;
}

.inventory-refresh-control #refresh-limit-note {
    color: rgba(244, 247, 250, 0.82);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.inventory-source-control select,
.inventory-source-control input,
.inventory-filters input,
.inventory-filters select {
    min-height: 38px;
    border: 1.5px solid #c5cdd6;
    border-radius: 6px;
    background: #fff;
    color: #1a242e;
    padding: 0 10px;
    font: inherit;
    font-weight: 600;
}
.inventory-source-control select:focus,
.inventory-source-control input:focus {
    outline: 2px solid color-mix(in srgb, var(--accent, #16a34a) 35%, transparent);
    border-color: var(--accent, #16a34a);
}

.inventory-filters input {
    min-width: 220px;
}

.inventory-btn {
    min-height: 38px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.inventory-btn-primary {
    background: var(--accent, #16a34a);
    border-color: var(--accent, #16a34a);
    color: #fff;
}

/* Non-primary buttons that sit on the teal hero gradient (e.g. Get Extension) need
   higher-contrast styling so they don't wash out against the dark background. */
.inventory-actions .inventory-btn:not(.inventory-btn-primary) {
    background: #fff;
    border: 1.5px solid #c5cdd6;
    color: #1a242e;
}
.inventory-actions .inventory-btn:not(.inventory-btn-primary):hover {
    border-color: var(--accent, #16a34a);
    color: var(--accent, #16a34a);
}

.inventory-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.inventory-stat,
.inventory-panel,
.inventory-card {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--card-bg-solid);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

.inventory-stat {
    padding: 10px 14px;
    min-width: 0;
}

.inventory-stat-label {
    color: #4a5560;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.inventory-stat-value {
    margin-top: 3px;
    font-size: 20px;
    font-weight: 800;
    white-space: nowrap;
    color: #1a242e;
    letter-spacing: 0.01em;
}

.inventory-stat-sub {
    margin-top: 2px;
    color: #6b7682;
    font-size: 11px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Legacy class kept in case other code references it. The Phase 4 layout no longer uses a 2-column workspace. */
.inventory-workspace { display: block; margin-bottom: 16px; }

.inventory-panel {
    padding: 16px;
    margin-bottom: 16px;
}

.inventory-workspace .inventory-panel {
    margin-bottom: 0;
}

.inventory-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.inventory-panel-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #1a242e;
}

.inventory-panel-header span,
#inventory-count-label {
    color: #6b7682;
    font-size: 12px;
    font-weight: 500;
}

.inventory-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 12px;
}

.inventory-filters .inventory-search {
    flex: 0 0 200px;
    min-height: 30px;
    padding: 0 11px;
    border: 1.5px solid #c5cdd6;
    border-radius: 6px;
    background: #fff;
    color: #1a242e;
    font: inherit;
    font-size: 12px;
    font-weight: 500;
}
.inventory-filters .inventory-search::placeholder { color: #8b95a0; }
.inventory-filters .inventory-search:focus {
    outline: 2px solid color-mix(in srgb, var(--accent, #16a34a) 35%, transparent);
    border-color: var(--accent, #16a34a);
}

.inventory-filters .inventory-filter-select {
    min-height: 30px;
    padding: 0 9px;
    border: 1.5px solid #c5cdd6;
    border-radius: 6px;
    background: #fff;
    color: #1a242e;
    font: inherit;
    font-size: 11.5px;
    font-weight: 600;
}

.filter-spacer { flex: 1 1 auto; min-width: 0; }

.pill-group {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}
.pill-group + .pill-group::before {
    content: "";
    display: inline-block;
    width: 1px; height: 18px;
    background: var(--border-color);
    opacity: 0.5;
    margin: 0 4px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1.5px solid #c5cdd6;
    background: #f5f7fa;
    color: #2d3640;
    font: inherit;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.12s ease;
    user-select: none;
    line-height: 1;
}
.pill:hover {
    border-color: #1a242e;
    color: #1a242e;
    background: #fff;
}
.pill.empty { opacity: 0.55; }
.pill.empty[aria-pressed="true"] { opacity: 1; }
.pill[aria-pressed="true"] {
    color: #fff;
    border-color: transparent;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.pill.r-consumer[aria-pressed="true"]   { background: var(--rarity-consumer); color: #1a1a1a; }
.pill.r-industrial[aria-pressed="true"] { background: var(--rarity-industrial); }
.pill.r-mil-spec[aria-pressed="true"]   { background: var(--rarity-milspec); }
.pill.r-restricted[aria-pressed="true"] { background: var(--rarity-restricted); }
.pill.r-classified[aria-pressed="true"] { background: var(--rarity-classified); }
.pill.r-covert[aria-pressed="true"]     { background: var(--rarity-covert); }

.pill.wear-pill[aria-pressed="true"] { background: var(--accent, #16a34a); color: #fff; }
.pill.flag-pill[aria-pressed="true"] {
    background: color-mix(in srgb, var(--accent, #16a34a) 18%, transparent);
    color: var(--accent, #16a34a);
    border-color: var(--accent, #16a34a);
}

.building-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 12px;
    border-radius: 999px;
    background: var(--rarity-restricted);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}
.building-chip[hidden] { display: none; }
.building-chip button {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    opacity: 0.85;
    line-height: 1;
    padding: 0 2px;
}
.building-chip button:hover { opacity: 1; }
.building-chip.r-consumer   { background: var(--rarity-consumer); color: #1a1a1a; }
.building-chip.r-industrial { background: var(--rarity-industrial); }
.building-chip.r-milspec    { background: var(--rarity-milspec); }
.building-chip.r-restricted { background: var(--rarity-restricted); }
.building-chip.r-classified { background: var(--rarity-classified); }
.building-chip.r-covert     { background: var(--rarity-covert); }
.building-chip.r-consumer button { color: #1a1a1a; }

.inventory-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 4px;
}

.inventory-skin-card {
    position: relative;
    min-height: 0;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--card-bg-solid);
    padding: 8px;
    display: grid;
    grid-template-rows: auto auto auto auto auto;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease, opacity 140ms ease;
    cursor: pointer;
}
.inventory-skin-card.incompatible,
.inventory-skin-card.unavailable {
    cursor: not-allowed;
}

.inventory-skin-card:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--accent, #16a34a) 60%, transparent);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
}

.inventory-skin-card.selected {
    border-color: var(--accent, #16a34a);
    box-shadow: inset 0 0 0 1px var(--accent, #16a34a);
}

.inventory-skin-card.incompatible {
    opacity: 0.32;
    pointer-events: none;
    filter: saturate(0.6);
}

.inventory-skin-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
}

.inventory-skin-card-top .rarity-pill,
.inventory-skin-card-top .hold-badge {
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inventory-skin-image {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #2a3a44 0%, #1a242a 100%);
    border-radius: 6px;
    padding: 4px;
    overflow: hidden;
}

.inventory-skin-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
}

.inventory-skin-image span,
.selected-slot-image span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 800;
}

.inventory-skin-body {
    min-width: 0;
}

.inventory-skin-name {
    min-height: 30px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Collection subtitle removed from cards (Phase 4) — collection filter pills + rarity bar already convey this. */
.inventory-skin-collection {
    display: none;
}

.inventory-skin-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.inventory-skin-metrics div {
    min-width: 0;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 4px 6px;
    background: color-mix(in srgb, var(--text-primary) 3%, transparent);
}

.inventory-skin-metrics span {
    display: block;
    color: var(--text-secondary);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.inventory-skin-metrics strong {
    display: block;
    margin-top: 1px;
    color: var(--text-primary);
    font-size: 11.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    overflow: visible;
    white-space: nowrap;
}

.rarity-pill {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    min-height: 18px;
    border-radius: 999px;
    padding: 0 7px;
    color: var(--text-secondary);
    background: color-mix(in srgb, var(--text-secondary) 14%, transparent);
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.rarity-pill.consumer-grade { color: #b0c3d9; }
.rarity-pill.industrial-grade { color: #5e98d9; }
.rarity-pill.mil-spec,
.rarity-pill.mil-spec-grade { color: #4b69ff; }
.rarity-pill.restricted { color: #8847ff; }
.rarity-pill.classified { color: #d32ce6; }
.rarity-pill.covert { color: #eb4b4b; }

.asset-toggle {
    width: 100%;
    min-height: 24px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 10.5px;
    cursor: pointer;
    transition: all 0.12s ease;
}
.asset-toggle:hover {
    background: var(--accent, #16a34a);
    border-color: var(--accent, #16a34a);
    color: #fff;
}

.asset-toggle.selected {
    border-color: var(--accent, #16a34a);
    color: var(--accent, #16a34a);
}

.asset-toggle:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.hold-badge {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    border-radius: 999px;
    padding: 0 7px;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.02em;
    background: color-mix(in srgb, var(--text-secondary) 14%, transparent);
    color: var(--text-secondary);
}

.hold-badge.held {
    background: color-mix(in srgb, #f59e0b 18%, transparent);
    color: #d97706;
}

.hold-badge.clear {
    background: color-mix(in srgb, #16a34a 16%, transparent);
    color: #16a34a;
}

.hold-badge.expired {
    background: color-mix(in srgb, #64748b 16%, transparent);
    color: var(--text-secondary);
}

.selected-assets {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.selected-slot {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-height: 64px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
}

.selected-slot.empty {
    color: var(--text-secondary);
    border-style: dashed;
    grid-template-columns: 1fr;
    min-height: 48px;
}

.selected-slot-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 46px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--text-secondary) 8%, transparent);
}

.selected-slot-image img {
    max-width: 100%;
    max-height: 44px;
    object-fit: contain;
}

.selected-slot-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.selected-slot-sub,
.builder-status,
.builder-result-sub {
    color: var(--text-secondary);
    font-size: 12px;
}

.remove-selected {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 800;
}

.builder-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.builder-metric {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
}

.builder-metric-label {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.builder-metric-value {
    margin-top: 4px;
    font-weight: 800;
}

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

.builder-actions .inventory-btn {
    flex: 1;
}

.builder-result {
    display: grid;
    gap: 10px;
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.result-output-list {
    display: grid;
    gap: 8px;
}

.result-output {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}

.result-output-title {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-output-profit {
    font-weight: 800;
    color: var(--success, #16a34a);
}

.result-output-profit.negative,
.inventory-card-profit.negative {
    color: var(--danger, #ef4444);
}

.inventory-card-list {
    display: grid;
    gap: 10px;
}

.inventory-card {
    padding: 14px;
}

.inventory-card-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.inventory-card-title {
    font-weight: 800;
}

.inventory-card-meta,
.inventory-owned-assets {
    color: var(--text-secondary);
    font-size: 13px;
}

.inventory-card-profit {
    font-weight: 800;
    color: var(--success, #16a34a);
    white-space: nowrap;
}

.inventory-card-actions {
    margin-top: 10px;
}

.inventory-empty {
    color: var(--text-secondary);
    padding: 18px 0;
}

.inventory-recommendations-panel[hidden],
.inventory-batches-panel[hidden] {
    display: none;
}

.inventory-recommendations-list,
.inventory-batches-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: 10px;
}

.inventory-batch-recipe {
    display: grid;
    gap: 5px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #f8fafc;
}

.inventory-batch-recipe:empty {
    display: none;
}

.inventory-batch-recipe-title {
    color: #1a242e;
    font-size: 13px;
    font-weight: 800;
}

.inventory-batch-recipe-line {
    color: #334155;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.35;
}

.inventory-batch-recipe-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
}

.inventory-recommendation-card {
    display: grid;
    gap: 10px;
    min-width: 0;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #fafbfc;
    padding: 12px;
}

.inventory-recommendation-card.locked {
    opacity: 0.78;
}

.inventory-recommendation-main {
    min-width: 0;
}

.inventory-recommendation-title {
    color: #1a242e;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
}

.inventory-recommendation-output {
    margin-top: 3px;
    color: #6b7682;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inventory-recommendation-metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
}

.inventory-recommendation-metrics div {
    min-width: 0;
    border: 1px solid var(--border-light);
    border-radius: 5px;
    background: #fff;
    padding: 5px 6px;
}

.inventory-recommendation-metrics span {
    display: block;
    color: #6b7682;
    font-size: 8.5px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.inventory-recommendation-metrics strong {
    display: block;
    margin-top: 2px;
    color: #1a242e;
    font-size: 12px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inventory-recommendation-metrics strong.positive {
    color: #16a34a;
}

.inventory-recommendation-metrics strong.negative {
    color: #dc2626;
}

.inventory-recommendation-assets {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 23px;
    align-items: center;
}

.recommendation-asset-chip {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border-radius: 999px;
    padding: 0 8px;
    background: color-mix(in srgb, #16a34a 13%, transparent);
    color: #15803d;
    font-size: 10.5px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.recommendation-asset-chip.held {
    background: color-mix(in srgb, #f59e0b 18%, transparent);
    color: #b45309;
}

.recommendation-asset-chip.muted {
    background: color-mix(in srgb, #64748b 14%, transparent);
    color: #475569;
}

.recommendation-assets-empty {
    color: #6b7682;
    font-size: 11px;
    font-style: italic;
}

.inventory-recommendation-actions {
    display: flex;
    justify-content: flex-end;
}

.inventory-recommendation-actions .inventory-btn {
    min-height: 32px;
    font-size: 11.5px;
}

@media (max-width: 1080px) {
    .inventory-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .inventory-workspace {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .inventory-header {
        flex-direction: column;
    }

    .inventory-actions {
        justify-content: flex-start;
    }

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

    .inventory-source-control,
    .inventory-refresh-control {
        width: calc(50% - 5px);
        max-width: none;
    }

    .inventory-refresh-control .inventory-btn {
        width: 100%;
    }

    .inventory-filters input,
    .inventory-filters select {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .inventory-grid,
    .builder-metrics,
    .result-summary,
    .inventory-recommendation-metrics {
        grid-template-columns: 1fr;
    }

    .inventory-source-control,
    .inventory-refresh-control {
        width: 100%;
    }
}

/* ============================================================
   Inventory workspace
   Owned inputs fill the first row. Builder sections sit underneath
   as compact columns on desktop and stack on smaller viewports.
   ============================================================ */

.inventory-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
}

.inventory-builder-panel {
    margin-bottom: 0;
}
.inventory-builder-status {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6b7682;
    font-size: 12px;
    font-weight: 500;
}

/* Stats summary bar — mirrors builder page tradeup-stats-bar */
.tradeup-stats-bar.inventory-stats-bar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 16px;
    background: var(--card-bg-solid);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 14px 22px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}
.inventory-stats-bar .stats-item { text-align: center; min-width: 0; }
.inventory-stats-bar .stats-item-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7682;
    margin-bottom: 4px;
}
.inventory-stats-bar .stats-item-value {
    font-size: 18px;
    font-weight: 800;
    color: #1a242e;
    font-variant-numeric: tabular-nums;
}
.inventory-stats-bar .stats-item-value.cost { color: var(--accent, #16a34a); }
.inventory-stats-bar .stats-item-value.positive { color: #16a34a; }
.inventory-stats-bar .stats-item-value.negative { color: #dc2626; }
.inventory-stats-bar .stats-item-value.placeholder { color: #c5cdd6; }
@media (max-width: 1024px) {
    .tradeup-stats-bar.inventory-stats-bar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.side-section {
    background: var(--card-bg-solid);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

.side-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 8px;
}
.side-section-header h3 {
    margin: 0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #1a242e;
}
.side-section-header span {
    font-size: 11px;
    color: #6b7682;
    font-weight: 600;
}

/* Inputs section — slot list. Same auto-fill template as outputs so card widths match. */
.side-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 8px;
    padding-right: 2px;
}

.souvenir-input-warning {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
    background: color-mix(in srgb, var(--accent) 13%, transparent);
    color: #7f3f1f;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.35;
    text-align: center;
}
.souvenir-input-warning strong {
    color: #5f2f18;
}

.side-slot {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: #fafbfc;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.side-slot.empty {
    border-style: dashed;
    background: transparent;
    opacity: 0.55;
    align-items: center;
    justify-content: center;
    min-height: 110px;
}
.side-slot-num {
    position: absolute;
    top: 6px;
    left: 8px;
    font-size: 10px;
    font-weight: 800;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.55);
    padding: 1px 7px;
    border-radius: 10px;
    line-height: 1.4;
    z-index: 1;
}
.side-slot.empty .side-slot-num {
    position: static;
    font-size: 15px;
    color: #6b7682;
    background: transparent;
    padding: 0;
}
.side-slot-empty-text {
    font-size: 12px;
    color: #6b7682;
    font-style: italic;
}
.side-slot-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #2a3a44 0%, #1a242a 100%);
    border-radius: 6px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.side-slot-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
}
.side-slot-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.side-slot-name {
    font-size: 12px;
    font-weight: 700;
    color: #1a242e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.side-slot-chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}
.side-slot-chip {
    min-width: 0;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 3px 6px;
    background: color-mix(in srgb, var(--text-primary) 3%, transparent);
}
.side-slot-chip span {
    display: block;
    color: #6b7682;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.side-slot-chip strong {
    display: block;
    margin-top: 1px;
    color: #1a242e;
    font-size: 11px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.side-slot-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: background 0.12s ease;
}
.side-slot-remove:hover { background: var(--danger, #dc2626); }

.side-summary {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
    font-size: 11px;
    color: #6b7682;
    font-weight: 500;
}
.side-summary strong { color: #1a242e; font-weight: 700; }

/* Outputs section */
.side-empty {
    padding: 18px 8px;
    text-align: center;
    font-size: 11px;
    color: #6b7682;
    font-style: italic;
}

.side-outputs-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 8px;
}
.output-row {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border-radius: 7px;
    background: #fafbfc;
    border: 1px solid var(--border-light);
}
.output-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #2a3a44 0%, #1a242a 100%);
    border-radius: 6px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.output-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
}
.output-thumb .output-thumb-fallback {
    font-size: 10px;
    font-weight: 800;
    color: #6b7682;
    letter-spacing: 0.04em;
}
.output-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.output-name {
    font-size: 12px;
    font-weight: 700;
    color: #1a242e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.output-meta {
    font-size: 10px;
    color: #6b7682;
    font-weight: 500;
    line-height: 1.25;
}
.output-row-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    padding-top: 4px;
    border-top: 1px solid var(--border-light);
}
.output-price-edit-wrap {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 700;
    color: #1a242e;
}
.output-price-edit {
    width: 64px;
    min-height: 24px;
    padding: 0 6px;
    border: 1px solid #c5cdd6;
    border-radius: 4px;
    background: #fff;
    color: #1a242e;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.output-price-edit:focus {
    outline: 2px solid color-mix(in srgb, var(--accent, #16a34a) 35%, transparent);
    border-color: var(--accent, #16a34a);
}
.output-profit {
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.output-profit.positive { color: #16a34a; }
.output-profit.negative { color: #dc2626; }

/* Editable price input on input slots */
.side-slot-chip-price {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.slot-price-edit {
    width: 100%;
    min-width: 0;
    min-height: 22px;
    padding: 0 5px;
    border: 1px solid #c5cdd6;
    border-radius: 4px;
    background: #fff;
    color: #1a242e;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.slot-price-edit:focus {
    outline: 2px solid color-mix(in srgb, var(--accent, #16a34a) 35%, transparent);
    border-color: var(--accent, #16a34a);
}

/* Result section — metric grid + actions */
.side-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 10px;
}
.metric-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 7px 10px;
    border-radius: 5px;
    background: #fafbfc;
    border: 1px solid var(--border-light);
}
.metric-label {
    font-size: 9px;
    font-weight: 800;
    color: #6b7682;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.metric-value {
    font-size: 14px;
    font-weight: 800;
    color: #1a242e;
    font-variant-numeric: tabular-nums;
}
.metric-value.positive { color: #16a34a; }
.metric-value.negative { color: #dc2626; }
.metric-value.placeholder { color: #c5cdd6; }

.side-actions {
    display: flex;
    gap: 6px;
}
.side-actions .inventory-btn {
    flex: 1;
    min-height: 32px;
    font-size: 11.5px;
}

@media (max-width: 1024px) {
    .inventory-side {
        grid-template-columns: 1fr;
    }
    .side-slots,
    .side-outputs-list {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

/* Ghost button variant for tray + filter clears */
.inventory-btn.ghost {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}
.inventory-btn.ghost:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

/* Refresh button accent on the small ↻ icon */
#refresh-inventory { letter-spacing: 0.04em; }

/* ============================================================
   Chrome extension install page
   ============================================================ */
.extension-install-shell {
    max-width: min(1180px, calc(100vw - 32px));
}

.extension-install-header {
    align-items: center;
}

.extension-install-title {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.extension-install-icon {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    background: #ffffff;
    padding: 8px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
    flex: 0 0 auto;
}

.extension-install-kicker {
    margin: 0 0 4px;
    color: rgba(244, 247, 250, 0.78);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.extension-install-actions {
    align-items: center;
}

.extension-install-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    background: rgba(14, 24, 35, 0.72);
    color: rgba(244, 247, 250, 0.88);
    font-size: 13px;
    font-weight: 600;
}

.extension-install-status strong {
    color: #ffffff;
}

.extension-install-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.5fr);
    gap: 16px;
    align-items: start;
}

.extension-install-panel {
    margin-bottom: 0;
}

.extension-install-steps {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.extension-install-steps li {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #fafbfc;
}

.extension-install-step-number {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #1a242e;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.extension-install-steps h3,
.extension-install-note-list h3 {
    margin: 0;
    color: #1a242e;
    font-size: 13px;
    font-weight: 800;
}

.extension-install-steps p,
.extension-install-note-list p {
    margin: 4px 0 0;
    color: #5e6873;
    font-size: 12.5px;
    line-height: 1.5;
    font-weight: 500;
}

.extension-install-steps code {
    padding: 2px 5px;
    border-radius: 4px;
    background: #eef2f5;
    color: #1a242e;
    font-size: 12px;
    font-weight: 700;
}

.extension-install-note-list {
    display: grid;
    gap: 14px;
}

.extension-install-note-list > div {
    padding: 0 0 14px;
    border-bottom: 1px solid var(--border-light);
}

.extension-install-note-list > div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.extension-install-note-list .inventory-btn {
    margin-top: 10px;
}

.extension-install-fallback summary {
    color: #1a242e;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
}

.extension-install-fallback summary::marker {
    color: #5e6873;
}

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

    .extension-install-status {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .extension-install-title {
        align-items: flex-start;
    }

    .extension-install-icon {
        width: 52px;
        height: 52px;
    }

    .extension-install-actions,
    .extension-install-actions .inventory-btn {
        width: 100%;
    }

    .extension-install-steps li {
        grid-template-columns: 32px minmax(0, 1fr);
        padding: 12px;
    }
}
