/* Unit Deployment & Upgrade Page - Futuristic Style */

.units-deployment-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    padding: 2rem;
    color: #e0e0e0;
    position: relative;
}

/* Background map effect */
.units-deployment-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('/images/battle-background.webp');
    background-size: cover;
    background-position: center;
    opacity: 0.1;
    z-index: 0;
    pointer-events: none;
}

.units-deployment-container > * {
    position: relative;
    z-index: 1;
}

/* Header */
.units-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.units-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #00d4ff;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.5),
                 0 0 40px rgba(0, 212, 255, 0.3);
    letter-spacing: 3px;
    margin: 0;
}

/* Tabs */
.units-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.unit-tab {
    background: rgba(30, 30, 50, 0.8);
    border: 2px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    padding: 1rem 2rem;
    color: #b0b0b0;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.unit-tab:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.6);
    color: #00d4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.unit-tab.active {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.2) 0%, rgba(0, 255, 150, 0.2) 100%);
    border-color: #00ff96;
    color: #00ff96;
    box-shadow: 0 0 20px rgba(0, 255, 150, 0.4);
}

.tab-icon {
    font-size: 1.5rem;
}

.tab-label {
    font-size: 0.9rem;
}

/* Unit List Container */
.units-list-container {
    max-width: 1200px;
    margin: 0 auto;
}

.units-fit-grid {
    max-width: 1300px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 0.75rem;
    align-items: start;
}

.units-main-column {
    min-width: 0;
}

.units-side-panel {
    position: sticky;
    top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

/* Unit Row */
.unit-row {
    background: var(--cg-surface-bg);
    border: 1px solid var(--cg-surface-border);
    border-radius: var(--cg-surface-radius);
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    display: grid;
    grid-template-columns: 80px 1fr 160px;
    gap: 1rem;
    align-items: start;
    transition: transform var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
    backdrop-filter: blur(10px);
    box-shadow: var(--cg-surface-shadow);
}

.unit-row:hover {
    border-color: var(--cg-surface-border-hover);
    box-shadow: var(--cg-surface-shadow-hover);
    transform: translateY(-2px);
}

.unit-row.locked {
    opacity: 0.6;
}

.unit-row.locked:hover {
    border-color: var(--cg-surface-border);
    transform: none;
    box-shadow: var(--cg-surface-shadow);
}

/* Unit Image */
.unit-row-image {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 8px;
    border: 2px solid rgba(0, 212, 255, 0.3);
    padding: 0.5rem;
    flex-shrink: 0;
}

.unit-image-small {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.5));
}

.unit-row.locked .unit-image-small {
    filter: grayscale(70%) brightness(0.5);
}

/* Unit Info */
.unit-row-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
    overflow: hidden;
}

.unit-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.unit-tier-name {
    font-size: 1rem;
    font-weight: 700;
    color: #00d4ff;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.unit-row.locked .unit-tier-name {
    color: #888;
}

/* Status Badge */
.unit-status-badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.unit-status-badge.available {
    background: rgba(0, 255, 150, 0.2);
    color: #00ff96;
    border: 1px solid rgba(0, 255, 150, 0.5);
}

.unit-status-badge.research-required {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.5);
}

.unit-status-badge.building-required {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.5);
}

/* Unit Details */
.unit-row-details {
    display: grid;
    grid-template-columns: 100px 200px 180px 90px 90px;
    gap: 1rem;
    align-items: start;
}

@media (max-width: 1200px) {
    .unit-row-details {
        grid-template-columns: 90px 170px 150px 80px 80px;
        gap: 0.75rem;
    }
}

@media (max-width: 768px) {
    .unit-row-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

.unit-detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

.detail-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    white-space: nowrap;
}

.detail-value {
    font-size: 1rem;
    color: #e0e0e0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    word-break: break-word;
}

.detail-value.attack-value {
    color: #ff6b6b;
    font-size: 1.2rem;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

/* Unit Actions */
.unit-row-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 160px;
    flex-shrink: 0;
}

.unit-action-btn {
    padding: 0.75rem 1rem;
    border: 2px solid;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.train-btn {
    background: rgba(0, 255, 150, 0.1);
    border-color: #00ff96;
    color: #00ff96;
}

.train-btn:hover:not(:disabled) {
    background: rgba(0, 255, 150, 0.2);
    box-shadow: 0 0 15px rgba(0, 255, 150, 0.4);
    transform: scale(1.05);
}

.train-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.default-btn {
    background: rgba(251, 191, 36, 0.2);
    border-color: #fbbf24;
    color: #fbbf24;
}

.default-btn:hover:not(:disabled) {
    background: rgba(251, 191, 36, 0.3);
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
    transform: scale(1.05);
}

.default-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.disabled-btn {
    background: rgba(100, 100, 100, 0.2);
    border-color: #666;
    color: #666;
    cursor: not-allowed;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1040;
    backdrop-filter: blur(5px);
}

.modal-dialog-centered {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1050;
    width: 90%;
    max-width: 500px;
}

.unit-train-modal {
    background: rgba(20, 20, 35, 0.95);
    border: 2px solid rgba(0, 212, 255, 0.5);
    border-radius: 12px;
    color: #e0e0e0;
    backdrop-filter: blur(10px);
}

.unit-train-modal .modal-header {
    border-bottom: 1px solid rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.1);
}

.unit-train-modal .modal-title {
    color: #00d4ff;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.unit-train-modal .btn-close {
    filter: invert(1);
}

.unit-train-modal .form-control {
    background: rgba(30, 30, 50, 0.8);
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: #e0e0e0;
}

.unit-train-modal .form-control:focus {
    background: rgba(30, 30, 50, 0.9);
    border-color: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
    color: #e0e0e0;
}

.cost-breakdown {
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.cost-breakdown h6 {
    color: #00d4ff;
    margin-bottom: 0.5rem;
}

.cost-breakdown ul {
    margin: 0;
    padding-left: 1.5rem;
}

.cost-breakdown li {
    color: #e0e0e0;
    margin-bottom: 0.3rem;
}

.unit-train-modal .modal-footer {
    border-top: 1px solid rgba(0, 212, 255, 0.3);
}

.unit-train-modal .btn-primary {
    background: rgba(0, 255, 150, 0.2);
    border-color: #00ff96;
    color: #00ff96;
}

.unit-train-modal .btn-primary:hover:not(:disabled) {
    background: rgba(0, 255, 150, 0.3);
    box-shadow: 0 0 15px rgba(0, 255, 150, 0.4);
}

.unit-train-modal .btn-secondary {
    background: rgba(100, 100, 100, 0.2);
    border-color: #666;
    color: #999;
}

.unit-train-modal .btn-secondary:hover {
    background: rgba(100, 100, 100, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .units-title {
        font-size: 1.8rem;
    }
    
    .unit-row {
        grid-template-columns: 80px 1fr;
        gap: 0.75rem;
    }
    
    .unit-row-actions {
        grid-column: 1 / -1;
        width: 100%;
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .unit-action-btn {
        flex: 1;
    }
    
    .unit-row-image {
        width: 80px;
        height: 80px;
    }
    
    .unit-row-details {
        grid-template-columns: 1fr;
    }
    
    .unit-row-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .units-tabs {
        flex-direction: column;
    }
    
    .unit-tab {
        width: 100%;
        justify-content: center;
    }
}

/* Work token production (Token_system / unit-production-system.md) */
.work-token-queue-banner {
    max-width: 720px;
    margin: 0 auto 1.25rem;
    padding: 0.85rem 1.1rem;
    background: rgba(0, 40, 60, 0.55);
    border: 1px solid rgba(0, 212, 255, 0.45);
    border-radius: 8px;
    font-size: 0.95rem;
}

.work-token-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: rgba(20, 25, 45, 0.85);
    border: 1px solid rgba(0, 212, 255, 0.35);
    border-radius: 10px;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.work-token-bar img {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    object-fit: contain;
}

.work-token-tier-panel {
    margin-top: 0.75rem;
    padding: 0.65rem 0.75rem;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.work-token-tier-panel .token-stepper {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.work-token-tier-panel .token-stepper button {
    min-width: 2rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid rgba(0, 212, 255, 0.4);
    background: rgba(0, 212, 255, 0.12);
    color: #00d4ff;
    cursor: pointer;
}

.work-token-tier-panel .token-stepper button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.work-token-footer {
    margin-top: 2rem;
    padding: 1.25rem;
    background: rgba(20, 25, 45, 0.9);
    border: 1px solid rgba(0, 212, 255, 0.4);
    border-radius: 10px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.work-token-footer .produce-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #0088aa, #00d4ff);
    color: #0a0a12;
    cursor: pointer;
}

.work-token-footer .produce-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* —— Production queue (3 slots) + compact unit list —— */
.units-production-queue {
    max-width: 100%;
    margin: 0;
    padding: 0.6rem 0.7rem;
    background: rgba(12, 18, 40, 0.92);
    border: 1px solid rgba(0, 212, 255, 0.45);
    border-radius: 10px;
}

.units-production-queue-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #00d4ff;
    margin-bottom: 0.35rem;
    opacity: 0.95;
}

.units-queue-count {
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
    font-size: 0.85rem;
    color: #7dffb3;
    margin-left: 0.25rem;
}

.units-queue-lede {
    margin: 0 0 0.45rem;
    font-size: 0.71rem;
    line-height: 1.3;
    color: #a8b0c4;
    max-width: 52rem;
}

.units-queue-slots-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.35rem;
}

@media (max-width: 720px) {
    .units-queue-slots-grid {
        grid-template-columns: 1fr;
    }
}

.units-queue-slot-card {
    min-height: 3.4rem;
    padding: 0.4rem 0.5rem;
    background: rgba(0, 30, 50, 0.55);
    border: 1px solid rgba(0, 212, 255, 0.32);
    border-radius: 8px;
    font-size: 0.73rem;
}

.units-queue-slot-card--empty {
    border-style: dashed;
    opacity: 0.7;
}

.units-queue-slot-card-head {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #5ac8e8;
    margin-bottom: 0.35rem;
}

.units-queue-slot-summary {
    color: #eaeef5;
    line-height: 1.3;
    font-weight: 500;
}

.units-queue-slot-time {
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

.units-queue-slot-card-empty {
    color: #7a8498;
    font-style: italic;
    padding-top: 0.25rem;
}

.units-token-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.35rem;
    max-width: 100%;
    margin: 0;
}

@media (max-width: 768px) {
    .units-token-strip {
        grid-template-columns: 1fr;
    }
}

.units-token-strip-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    background: rgba(20, 25, 45, 0.85);
    border: 1px solid rgba(0, 212, 255, 0.28);
    border-radius: 8px;
    font-size: 0.73rem;
}

.units-token-strip-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    flex-shrink: 0;
}

.units-token-strip-branch {
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #00d4ff;
    margin-bottom: 0.1rem;
}

.units-token-strip-unclaimed {
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: #ffc107;
}

.units-token-strip-unclaimed a {
    color: #7fdbff;
}

.units-token-hint {
    max-width: 100%;
    margin: 0;
    text-align: left;
    color: #a0a8b8;
    font-size: 0.68rem;
}

.units-branch-heading {
    max-width: 960px;
    margin: 1.5rem auto 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(0, 212, 255, 0.2);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #7fdbff;
}

.units-branch-heading:first-of-type {
    margin-top: 0.5rem;
}

.units-branch-emoji {
    margin-right: 0.35rem;
}

.unit-row-compact {
    max-width: 100%;
    margin: 0 0 0.35rem;
    display: grid;
    grid-template-columns: 52px 1fr minmax(150px, 200px);
    gap: 0.45rem;
    align-items: start;
    padding: 0.35rem 0.45rem;
    background: rgba(20, 20, 35, 0.88);
    border: 1px solid rgba(0, 212, 255, 0.18);
    border-radius: 8px;
    backdrop-filter: blur(8px);
}

.unit-row-compact.locked {
    opacity: 0.72;
    border-color: rgba(120, 120, 140, 0.25);
}

.unit-row-compact-img .unit-image-compact {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
}

.unit-row-compact-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem 0.4rem;
    font-weight: 600;
    color: #f0f0f0;
    line-height: 1.2;
}

.unit-row-compact-tier {
    color: #00ff96;
    font-size: 0.85rem;
}

.unit-row-compact-name {
    font-size: 0.88rem;
}

.unit-row-compact-badge {
    font-size: 0.65rem;
    padding: 0.12rem 0.35rem;
    border-radius: 4px;
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.unit-row-compact-stats {
    font-size: 0.7rem;
    color: #b8c0d0;
    margin-top: 0.15rem;
}

.unit-cost-inline {
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.68rem;
    color: #d2dae8;
    line-height: 1.25;
}

.unit-cost-inline-main {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unit-mini-info {
    width: 1rem;
    height: 1rem;
    border: 1px solid rgba(0, 212, 255, 0.45);
    border-radius: 50%;
    background: rgba(0, 212, 255, 0.14);
    color: #00d4ff;
    font-size: 0.65rem;
    line-height: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
}

.unit-cost-inline-warn {
    margin-top: 0.2rem;
    font-size: 0.68rem;
    color: #ffc107;
}

.unit-row-compact-actions {
    justify-self: stretch;
    align-self: center;
}

.unit-row-inline-bar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem;
}

.token-stepper-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
}

.token-stepper-inline .token-stepper-btn {
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border-radius: 4px;
    border: 1px solid rgba(0, 212, 255, 0.45);
    background: rgba(0, 212, 255, 0.12);
    color: #00d4ff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.token-stepper-inline .token-stepper-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.token-stepper-inline .token-stepper-val {
    min-width: 1.1rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.btn-queue-slot {
    flex-shrink: 0;
    padding: 0.26rem 0.5rem;
    font-weight: 700;
    font-size: 0.62rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    border: none;
    border-radius: 5px;
    background: linear-gradient(135deg, #0088aa, #00d4ff);
    color: #0a0a12;
    cursor: pointer;
    white-space: nowrap;
}

.btn-queue-slot:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.unit-row-compact-locked-msg {
    font-size: 0.72rem;
    color: #999;
    max-width: 7rem;
    text-align: right;
    line-height: 1.2;
}

@media (max-width: 520px) {
    .units-fit-grid {
        grid-template-columns: 1fr;
    }

    .units-side-panel {
        position: static;
        order: -1;
    }

    .unit-row-compact {
        grid-template-columns: 44px 1fr;
    }

    .unit-row-compact-actions {
        grid-column: 1 / -1;
        justify-self: stretch;
    }

    .unit-row-inline-bar {
        justify-content: space-between;
    }

    .unit-cost-inline-main {
        white-space: normal;
    }
}

/* === Unit Production v2 Mobile-first / Cyberpunk === */
.up-shell {
    min-height: 100vh;
    padding: var(--s-2) var(--s-3) calc(var(--bottomnav-h) + var(--safe-bot) + var(--s-4));
    position: relative;
    overflow: hidden;
    color: var(--text-primary);
    background: var(--bg-app);
}

.up-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, var(--accent-primary-wash) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
}

.up-shell > * {
    position: relative;
    z-index: 1;
}

.up-mono {
    font-family: var(--font-mono), ui-monospace, monospace;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
}

.glass-panel {
    background: var(--bg-surface-1);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-none);
    backdrop-filter: blur(8px);
    box-shadow: none;
}

.up-topbar {
    position: sticky;
    top: 0.25rem;
    z-index: 40;
    padding: 0.45rem 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.up-topbar-title {
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0;
    overflow-wrap: anywhere;
}

.up-topbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}

.up-topbar-actions {
    display: inline-flex;
    gap: 0.3rem;
}

.up-prod-compact-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    color: #d9ebff;
    white-space: nowrap;
    overflow-x: auto;
    padding-bottom: 0.05rem;
}

.up-prod-compact-label {
    font-weight: 700;
    color: #8cecff;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.up-prod-compact-muted {
    color: #9db7d2;
    white-space: nowrap;
}

.up-collect-all-btn {
    border-radius: 8px;
    border: 1px solid rgba(0, 212, 255, 0.35);
    background: rgba(0, 212, 255, 0.10);
    color: #7fe8ff;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.62rem;
    padding: 0.22rem 0.55rem;
    white-space: nowrap;
}

.up-collect-all-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.up-topbar-token-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
    min-width: 0;
}

.up-topbar-token-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    flex: 0 0 22px;
    display: block;
}

.up-token-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.25rem;
    align-items: center;
}

.up-token-pill {
    display: flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.22rem 0.25rem;
    border-radius: 8px;
    background: rgba(20, 28, 48, 0.8);
    min-width: 0;
}

.up-token-body {
    display: flex;
    align-items: center;
    min-width: 0;
    white-space: nowrap;
}

.up-token-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    margin-right: 0.1rem;
    display: block;
}

.up-token-name {
    font-size: 0.58rem;
    opacity: 0.85;
    color: rgba(220, 235, 255, 0.95);
}

.up-token-balance {
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(210, 255, 255, 0.98);
    line-height: 1;
    white-space: nowrap;
}

.up-collect-btn {
    margin-left: auto;
    border: 1px solid rgba(125, 255, 179, 0.5);
    background: rgba(0, 255, 150, 0.15);
    color: #7dffb3;
    border-radius: 6px;
    padding: 0.14rem 0.25rem;
    font-size: 0.54rem;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
}

.up-queue-strip {
    margin-top: 0.45rem;
    padding: 0.4rem 0.5rem;
}

.up-queue-title {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.3rem;
    color: #7fe8ff;
}

.up-queue-slots {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
}

@media (max-width: 767px) {
    .up-queue-slots {
        display: flex;
        overflow-x: auto;
        gap: 0.35rem;
        padding-bottom: 0.15rem;
    }

    .up-queue-slot {
        min-width: 8.8rem;
        flex: 0 0 auto;
    }

    .up-prod-status-grid {
        grid-template-columns: 1fr;
    }
}

.up-queue-slot {
    border: 1px solid rgba(0, 212, 255, 0.28);
    border-radius: 8px;
    padding: 0.28rem 0.35rem;
    font-size: 0.62rem;
    min-height: 2.4rem;
    background: rgba(10, 26, 40, 0.75);
    color: rgba(220, 235, 255, 0.95);
}

.up-queue-slot.empty {
    opacity: 0.72;
    border-style: dashed;
}

.up-queue-slot-head {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.up-queue-portrait {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.up-progress {
    width: 100%;
    height: 4px;
    margin-top: 0.2rem;
}

.up-queue-time {
    margin-top: 0.12rem;
    font-size: 0.6rem;
    color: rgba(180, 240, 255, 0.95);
}

.up-prod-status {
    margin-top: 0.45rem;
    padding: 0.45rem 0.55rem;
}

.up-prod-status-title {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.32rem;
    color: #7fe8ff;
    font-weight: 800;
}

.up-prod-status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.3rem;
}

.up-prod-status-item {
    border: 1px solid rgba(0, 212, 255, 0.22);
    border-radius: 8px;
    padding: 0.3rem 0.36rem;
    background: rgba(10, 26, 40, 0.66);
    min-height: 2.45rem;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.up-prod-status-k {
    font-size: 0.56rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(156, 194, 224, 0.95);
    font-weight: 700;
}

.up-prod-status-v {
    font-size: 0.66rem;
    color: rgba(225, 241, 255, 0.98);
    line-height: 1.25;
}

.up-progress {
    height: 6px;
    border-radius: 999px;
}

.up-progress::-webkit-progress-bar {
    background-color: rgba(0, 212, 255, 0.10);
    border-radius: 999px;
}

.up-progress::-webkit-progress-value {
    background-color: rgba(0, 212, 255, 0.85);
    border-radius: 999px;
}

.up-content {
    margin-top: 0.45rem;
}

.up-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
}

@media (min-width: 768px) and (max-width: 1023px) {
    .up-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    /* PC: jedna kolumna; zwarte karty jednowierszowe (wysokość ~ portret) */
    .up-cards-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.38rem;
    }
}

/* Tailwind-like grid column utility (works even without Tailwind configured) */
.grid-cols-1 { grid-template-columns: 1fr; }

@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
    .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1536px) {
    .\32xl\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.up-inspector-panel {
    display: none;
}

.up-inspector-empty {
    color: rgba(180, 200, 230, 0.9);
    font-size: 0.72rem;
    padding: 0.7rem;
}

.up-inspector {
    padding: 0.65rem 0.7rem;
}

.up-inspector-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.up-inspector-title {
    font-size: 0.85rem;
    font-weight: 900;
    color: #7ff7ff;
}

.up-inspector-model {
    border-radius: 10px;
    border: 1px solid rgba(0, 212, 255, 0.28);
    background: rgba(0, 212, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
    margin-bottom: 0.45rem;
    min-height: 0;
}

.up-inspector-portrait {
    width: 100%;
    max-height: 112px;
    object-fit: contain;
    display: block;
}

.up-inspector-label {
    font-weight: 900;
    color: #9fd8ff;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.up-inspector-text {
    font-size: 0.7rem;
    line-height: 1.4;
    color: rgba(210, 218, 232, 0.95);
}

.up-inspector-lore {
    margin-bottom: 0.55rem;
}

.up-inspector-advanced {
    margin-top: 0.2rem;
}

.up-inspector-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.35rem;
    margin-top: 0.35rem;
    font-size: 0.68rem;
}

@media (min-width: 1024px) {
    .up-shell {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto auto;
        grid-template-areas:
            "header"
            "queue"
            "body";
        column-gap: 0.75rem;
        row-gap: 0.35rem;
        max-width: none;
        margin: 0;
        padding: 5.65rem 0.75rem 0.75rem;
        min-height: 0;
        height: auto;
        align-items: start;
        overflow-x: hidden;
        overflow-y: visible;
    }

    .up-topbar {
        grid-area: header;
        position: static;
        top: auto;
    }

    .up-queue-strip {
        display: none !important;
    }

    .up-queue-desktop {
        display: block;
        grid-area: queue;
    }

    .up-page-body {
        grid-area: body;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 17.5rem;
        gap: 0.85rem;
        align-items: start;
        min-width: 0;
    }

    .up-content {
        margin-top: 0;
        margin-right: 0;
        min-width: 0;
    }

    .up-prod-summary {
        display: block;
        position: sticky;
        top: 5.5rem;
        align-self: start;
        max-height: none;
        overflow: visible;
        padding: 0.65rem 0.7rem;
        z-index: 30;
    }
}

@media (max-width: 1023px) {
    .up-queue-desktop {
        display: none !important;
    }

    .up-page-body {
        display: block;
    }

    .up-prod-summary {
        display: none !important;
    }
}

.up-card {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 0.45rem;
    padding: 0.4rem;
    margin-bottom: 0.36rem;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.up-card-mob {
    display: contents;
}

.up-card-desk {
    display: none;
}

.up-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 16px rgba(0, 232, 255, 0.3);
    background: rgba(12, 25, 46, 0.92);
    border-color: rgba(0, 232, 255, 0.55);
    animation: up-neon-pulse 1.2s ease-in-out infinite alternate;
}

@keyframes up-neon-pulse {
    0% { box-shadow: 0 0 14px rgba(0, 212, 255, 0.18); }
    50% { box-shadow: 0 0 22px rgba(0, 232, 255, 0.42); }
    100% { box-shadow: 0 0 32px rgba(125, 255, 179, 0.16); }
}

@media (min-width: 1024px) {
    /* Desktop: 3-kolumnowy production card + osobny panel akcji */
    .up-card {
        display: block;
        padding: 0.85rem 1rem;
        margin-bottom: 0.55rem;
    }

    .up-card-mob {
        display: none !important;
    }

    .up-card-desk {
        display: grid;
        grid-template-columns: 13.5rem minmax(0, 1fr) 15.5rem;
        grid-template-rows: auto auto;
        gap: 0.65rem 1.1rem;
        align-items: start;
        min-width: 0;
    }

    .up-desk-identity {
        grid-column: 1;
        grid-row: 1;
        display: grid;
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 0.5rem;
        align-items: flex-start;
        min-width: 0;
        overflow: hidden;
    }

    .up-desk-portrait-wrap {
        position: relative;
        flex: 0 0 auto;
    }

    .up-desk-portrait {
        width: 72px;
        height: 72px;
        object-fit: contain;
        border-radius: 10px;
        border: 1px solid rgba(0, 212, 255, 0.45);
        background: rgba(0, 212, 255, 0.1);
        display: block;
    }

    .up-desk-locked-pill {
        position: absolute;
        inset: auto 0 0 0;
        text-align: center;
        font-size: 0.52rem;
        font-weight: 900;
        letter-spacing: 0.1em;
        color: #ffcf5a;
        background: rgba(0, 0, 0, 0.55);
        padding: 0.12rem 0;
        border-radius: 0 0 8px 8px;
    }

    .up-desk-id-text {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 0.22rem;
    }

    .up-desk-name-row {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 0.35rem;
    }

    .up-desk-name {
        font-size: 0.95rem;
        font-weight: 900;
        color: #7ff7ff;
        line-height: 1.15;
    }

    .up-desk-tier {
        font-size: 0.78rem;
        font-weight: 800;
        color: #9fd8ff;
    }

    .up-desk-strategy {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
        padding: 0.45rem 0.55rem;
        border-radius: 10px;
        border: 1px solid rgba(0, 212, 255, 0.22);
        background: rgba(6, 18, 36, 0.55);
    }

    .up-desk-strategy-title {
        font-size: 0.62rem;
        font-weight: 900;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: #58f3ff;
        margin-bottom: 0.38rem;
    }

    .up-desk-stat-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.32rem 0.55rem;
    }

    .up-desk-stat {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 0.28rem;
        font-size: 0.72rem;
        min-width: 0;
    }

    .up-desk-stat-wide {
        grid-column: 1 / -1;
    }

    .up-desk-stat-ic {
        opacity: 0.95;
    }

    .up-desk-stat-lbl {
        color: rgba(170, 198, 224, 0.95);
        font-size: 0.65rem;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .up-desk-stat-val {
        color: rgba(230, 245, 255, 0.98);
        font-weight: 800;
        text-align: right;
        white-space: nowrap;
    }

    .up-desk-order-preview {
        margin-top: 0.45rem;
        padding-top: 0.38rem;
        border-top: 1px dashed rgba(0, 212, 255, 0.22);
        font-size: 0.68rem;
        color: rgba(210, 230, 248, 0.95);
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
    }

    .up-desk-order-lbl {
        font-size: 0.58rem;
        font-weight: 900;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        color: #7fe8ff;
    }

    .up-desk-hint {
        margin: 0.35rem 0 0;
        font-size: 0.6rem;
        line-height: 1.35;
        color: rgba(150, 180, 210, 0.88);
    }

    .up-desk-panel {
        grid-column: 3;
        grid-row: 1;
        align-self: stretch;
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        padding: 0.5rem 0.55rem;
        border-radius: 12px;
        border: 1px solid rgba(0, 232, 255, 0.45);
        background: linear-gradient(165deg, rgba(0, 40, 60, 0.9), rgba(8, 22, 44, 0.92));
        box-shadow: 0 0 22px rgba(0, 212, 255, 0.18);
    }

    .up-desk-panel.locked {
        border-color: rgba(255, 193, 7, 0.45);
        box-shadow: 0 0 18px rgba(255, 193, 7, 0.12);
    }

    .up-desk-panel-label {
        font-size: 0.58rem;
        font-weight: 900;
        letter-spacing: 0.14em;
        color: rgba(140, 210, 255, 0.95);
    }

    .up-desk-stepper {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.35rem;
    }

    .up-desk-step {
        width: 1.7rem;
        height: 1.7rem;
        border-radius: 8px;
        border: 1px solid rgba(0, 212, 255, 0.55);
        background: rgba(0, 212, 255, 0.14);
        color: #7fe8ff;
        font-size: 1rem;
        font-weight: 900;
        line-height: 1;
    }

    .up-desk-step:hover:not(:disabled) {
        background: rgba(0, 212, 255, 0.28);
        box-shadow: 0 0 12px rgba(0, 212, 255, 0.25);
    }

    .up-desk-step-val {
        min-width: 1.6rem;
        text-align: center;
        font-size: 1rem;
        font-weight: 900;
        color: rgba(235, 250, 255, 0.98);
    }

    .up-desk-step-input {
        width: 3.2rem;
        height: 1.7rem;
        border-radius: 8px;
        border: 1px solid rgba(0, 212, 255, 0.55);
        background: rgba(0, 212, 255, 0.12);
        color: rgba(235, 250, 255, 0.98);
        text-align: center;
        font-size: 0.9rem;
        font-weight: 900;
        padding: 0 0.2rem;
    }

    .up-desk-step-input::-webkit-outer-spin-button,
    .up-desk-step-input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    .up-desk-step-input[type=number] {
        -moz-appearance: textfield;
        appearance: textfield;
    }

    .up-desk-max {
        border-radius: 8px;
        border: 1px solid rgba(125, 255, 179, 0.65);
        background: rgba(125, 255, 179, 0.14);
        color: #b4ffd7;
        font-size: 0.66rem;
        font-weight: 900;
        letter-spacing: 0.08em;
        padding: 0.28rem 0.4rem;
        text-transform: uppercase;
    }

    .up-desk-max:hover {
        background: rgba(125, 255, 179, 0.24);
        box-shadow: 0 0 14px rgba(125, 255, 179, 0.22);
    }

    .up-desk-queue {
        border: none;
        border-radius: 10px;
        padding: 0.42rem 0.45rem;
        font-size: 0.74rem;
        font-weight: 900;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: #031018;
        background: linear-gradient(135deg, #00c8f0, #00ffe0);
        box-shadow: 0 0 22px rgba(0, 230, 255, 0.35);
    }

    .up-desk-cost-line {
        margin-top: 0.4rem;
        padding-top: 0.35rem;
        border-top: 1px dashed rgba(0, 212, 255, 0.22);
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem 0.45rem;
        font-size: 0.64rem;
        color: rgba(210, 230, 248, 0.95);
    }

    .up-desk-queue:hover:not(:disabled) {
        filter: brightness(1.06);
        box-shadow: 0 0 28px rgba(0, 255, 230, 0.45);
    }

    .up-desk-queue:disabled {
        opacity: 0.45;
        cursor: not-allowed;
        box-shadow: none;
    }

    .up-desk-unlock {
        border-radius: 10px;
        border: 1px solid rgba(255, 193, 7, 0.55);
        background: rgba(255, 193, 7, 0.14);
        color: #ffd34f;
        font-size: 0.78rem;
        font-weight: 900;
        letter-spacing: 0.1em;
        padding: 0.5rem 0.45rem;
        text-transform: uppercase;
    }

    .up-desk-unlock-reason {
        font-size: 0.65rem;
        line-height: 1.3;
        color: rgba(255, 214, 120, 0.95);
        overflow-wrap: anywhere;
    }

    .up-desk-warns {
        grid-column: 1 / -1;
        grid-row: 2;
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem 0.45rem;
    }

    .up-desk-warn {
        font-size: 0.62rem;
        font-weight: 800;
        color: #ffc107;
    }

    .up-card.locked .up-desk-portrait {
        filter: grayscale(0.85) brightness(0.75);
    }

    .up-card:hover {
        transform: translateY(-2px);
    }

    /* Desktop queue cards */
    .up-queue-desktop {
        padding: 0.65rem 0.75rem;
    }

    .up-queue-desktop-head {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        margin-bottom: 0.45rem;
    }

    .up-queue-desktop-title {
        font-size: 0.78rem;
        font-weight: 900;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: #58f3ff;
    }

    .up-queue-desktop-meta {
        font-size: 0.72rem;
        color: rgba(180, 220, 245, 0.95);
    }

    .up-queue-desktop-slots {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.55rem;
    }

    .up-queue-card {
        position: relative;
        min-height: 7.5rem;
        border-radius: 12px;
        border: 1px solid rgba(0, 212, 255, 0.35);
        background: rgba(8, 20, 38, 0.78);
        padding: 0.55rem 0.6rem;
        overflow: hidden;
    }

    .up-queue-card.empty {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        border-style: dashed;
        opacity: 0.88;
        background: rgba(6, 16, 32, 0.55);
    }

    .up-queue-card.active {
        border-color: rgba(0, 232, 255, 0.55);
        box-shadow: 0 0 18px rgba(0, 212, 255, 0.15);
    }

    .up-queue-card-slot-no {
        position: absolute;
        top: 0.35rem;
        right: 0.45rem;
        font-size: 0.62rem;
        font-weight: 900;
        color: rgba(120, 200, 255, 0.75);
    }

    .up-queue-card-empty-icon {
        font-size: 1.6rem;
        font-weight: 300;
        color: rgba(0, 212, 255, 0.55);
        line-height: 1;
        margin-bottom: 0.2rem;
    }

    .up-queue-card-empty-title {
        font-size: 0.75rem;
        font-weight: 900;
        color: rgba(210, 235, 255, 0.95);
    }

    .up-queue-card-empty-hint {
        font-size: 0.62rem;
        color: rgba(160, 190, 220, 0.85);
        margin-top: 0.15rem;
    }

    .up-queue-card-body {
        display: flex;
        gap: 0.45rem;
        padding-top: 0.15rem;
    }

    .up-queue-card-portrait {
        width: 44px;
        height: 44px;
        object-fit: contain;
        border-radius: 8px;
        border: 1px solid rgba(0, 212, 255, 0.35);
        background: rgba(0, 212, 255, 0.08);
        flex-shrink: 0;
    }

    .up-queue-card-info {
        min-width: 0;
        flex: 1;
    }

    .up-queue-card-name {
        font-size: 0.78rem;
        font-weight: 900;
        color: #7ff7ff;
    }

    .up-queue-card-qty {
        font-size: 0.65rem;
        color: rgba(190, 220, 245, 0.95);
        margin-top: 0.08rem;
    }

    .up-queue-card-remain {
        font-size: 0.62rem;
        color: rgba(160, 210, 240, 0.92);
        margin-top: 0.22rem;
    }

    .up-queue-card-progress {
        width: 100%;
        height: 8px;
        margin-top: 0.28rem;
        border-radius: 999px;
        overflow: hidden;
    }

    .up-queue-card-progress::-webkit-progress-bar {
        background: rgba(0, 212, 255, 0.12);
        border-radius: 999px;
    }

    .up-queue-card-progress::-webkit-progress-value {
        background: linear-gradient(90deg, #0099be, #00ffe0);
        border-radius: 999px;
    }

    .up-queue-card-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.35rem;
        margin-top: 0.32rem;
    }

    .up-queue-card-done {
        font-size: 0.58rem;
        color: rgba(170, 205, 235, 0.9);
    }

    .up-queue-card-cancel {
        font-size: 0.55rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        padding: 0.18rem 0.38rem;
        border-radius: 6px;
        border: 1px solid rgba(255, 99, 99, 0.45);
        background: rgba(255, 60, 60, 0.12);
        color: #ff8a8a;
    }

    .up-queue-card-cancel:disabled {
        opacity: 0.35;
        cursor: not-allowed;
    }

    /* Sidebar summary */
    .up-sum-title {
        font-size: 0.72rem;
        font-weight: 900;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: #58f3ff;
        margin-bottom: 0.45rem;
    }

    .up-sum-section {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.12rem;
        padding: 0.35rem 0;
        border-bottom: 1px solid rgba(0, 212, 255, 0.15);
    }

    .up-sum-section:last-of-type {
        border-bottom: none;
    }

    .up-sum-k {
        font-size: 0.58rem;
        font-weight: 800;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: rgba(150, 190, 220, 0.9);
    }

    .up-sum-v {
        font-size: 0.68rem;
        line-height: 1.3;
        color: rgba(220, 238, 255, 0.96);
    }

    .up-sum-collect {
        width: 100%;
        margin-top: 0.55rem;
        border-radius: 8px;
        border: 1px solid rgba(125, 255, 179, 0.55);
        background: rgba(125, 255, 179, 0.14);
        color: #b4ffd7;
        font-size: 0.68rem;
        font-weight: 900;
        letter-spacing: 0.08em;
        padding: 0.4rem 0.45rem;
        text-transform: uppercase;
    }
}

.up-card.locked .up-card-portrait {
    filter: grayscale(1) blur(1px) brightness(0.65);
}

.up-card-left {
    position: relative;
}

.up-card-portrait {
    width: 62px;
    height: 62px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.08);
}

.up-locked-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.56rem;
    letter-spacing: 0.08em;
    font-weight: 800;
}

.up-card-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.4rem;
    flex-wrap: wrap;
    min-width: 0;
}

.up-card-name {
    font-size: 0.84rem;
    font-weight: 700;
    color: #7ff7ff;
    line-height: 1.2;
    min-width: 0;
}

.up-card-tier {
    font-size: 0.76rem;
    font-weight: 700;
    color: #9fd8ff;
    flex-shrink: 0;
}

.up-card-body-row {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-width: 0;
}

.up-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.55rem;
    font-size: 0.68rem;
    color: #b8c7db;
    margin-top: 0.18rem;
}

.up-card-body-row .up-stats {
    margin-top: 0;
}

.up-cost-line {
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.28rem;
    flex-wrap: wrap;
    font-size: 0.66rem;
    color: rgba(220, 235, 255, 0.95);
}

.up-card-body-row .up-cost-line {
    margin-top: 0;
}

.up-mini-i {
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 212, 255, 0.5);
    background: rgba(0, 212, 255, 0.15);
    color: #5bf4ff;
    font-size: 0.62rem;
    line-height: 1;
    padding: 0;
}

.up-actions-row {
    margin-top: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.28rem;
}

.up-card-body-row .up-actions-row {
    margin-top: 0;
}

.up-step-btn,
.up-queue-btn,
.up-max-btn,
.up-unlock-btn {
    border-radius: 7px;
    border: none;
    font-weight: 700;
    text-transform: uppercase;
}

.up-step-btn {
    width: 1.35rem;
    height: 1.35rem;
    background: rgba(0, 212, 255, 0.18);
    color: #6eefff;
}

.up-step-count {
    min-width: 1.1rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(220, 245, 255, 0.98);
}

.up-step-input {
    width: 2.8rem;
    height: 1.35rem;
    border-radius: 6px;
    border: 1px solid rgba(0, 212, 255, 0.45);
    background: rgba(0, 212, 255, 0.1);
    color: rgba(220, 245, 255, 0.98);
    text-align: center;
    font-size: 0.75rem;
    padding: 0 0.15rem;
}

.up-step-input::-webkit-outer-spin-button,
.up-step-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.up-step-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.up-max-btn {
    border: 1px solid rgba(125, 255, 179, 0.55);
    background: rgba(125, 255, 179, 0.12);
    color: #b4ffd7;
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    padding: 0.26rem 0.45rem;
}

.up-queue-btn {
    margin-left: auto;
    background: linear-gradient(135deg, #0099be, #00d9ff);
    color: #06202c;
    font-size: 0.62rem;
    padding: 0.28rem 0.55rem;
}

.up-unlock-btn {
    margin-top: 0.35rem;
    background: rgba(255, 193, 7, 0.18);
    border: 1px solid rgba(255, 193, 7, 0.45);
    color: #ffd34f;
    font-size: 0.64rem;
    padding: 0.26rem 0.55rem;
}

.up-unlock-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.up-card-body-row .up-unlock-row {
    margin-top: 0;
}

.up-unlock-reason {
    font-size: 0.6rem;
    font-weight: 800;
    color: rgba(255, 214, 102, 0.95);
    line-height: 1.25;
    max-width: 8.5rem;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.up-warn {
    margin-top: 0.2rem;
    font-size: 0.62rem;
    color: #ffc107;
}

.up-bottom-tabs {
    position: fixed;
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.45rem;
    z-index: 45;
    padding: 0.25rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.25rem;
    align-items: stretch;
}

.up-tab-btn {
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-radius: 8px;
    background: rgba(12, 25, 46, 0.86);
    color: #9cb2d6;
    padding: 0.3rem 0.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 0.1rem;
    font-size: 0.62rem;
    transition: all 180ms ease;
}

.up-tab-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    display: block;
}

.up-tab-btn.active {
    color: #7dffb3;
    border-color: rgba(125, 255, 179, 0.55);
    box-shadow: 0 0 10px rgba(0, 255, 180, 0.28);
}

@media (min-width: 1024px) {
    /* PC: pasek gałęzi zakotwiczony na dole ekranu */
    .up-bottom-tabs {
        position: fixed;
        top: auto;
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.45rem;
        width: auto;
        margin: 0;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.4rem;
        padding: 0.35rem;
        z-index: 2000;
    }

    .up-tab-btn {
        flex-direction: row;
        justify-content: center;
        padding: 0.45rem 0.5rem;
        font-size: 0.72rem;
        gap: 0.45rem;
    }

    .up-tab-icon {
        width: 22px;
        height: 22px;
    }

    /* Większy odejmowany fragment — nad listą jest też pasek gałęzi */
    .up-content {
        max-height: none;
        overflow: visible;
        padding-right: 0.15rem;
    }
}

/* === Desktop recruitment refresh (clarity-first) === */
.up-shell {
    font-family: Inter, Roboto, "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
    font-variant-numeric: tabular-nums;
}

.up-token-row {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.up-tab-btn {
    position: relative;
}

.up-army-context {
    padding: 0.4rem 0.65rem;
    margin-bottom: 0.5rem;
}

.up-army-inline {
    display: grid;
    gap: 0.15rem;
    font-size: 0.72rem;
    color: #d6e9ff;
}

.up-army-row-total {
    white-space: nowrap;
}

.up-army-row-tiers {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 767px) {
    .up-topbar-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }

    .up-topbar-token-inline {
        width: 100%;
        flex-wrap: wrap;
        row-gap: 0.25rem;
    }
}

@media (min-width: 1024px) {
    .up-page-body {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 17.5rem;
        gap: 0.85rem;
        align-items: start;
        min-width: 0;
    }

    .up-prod-summary {
        display: block !important;
        position: sticky;
        top: 5.5rem;
        align-self: start;
    }

    .up-bottom-tabs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: calc(100% - 1.5rem);
        margin: 0 auto;
    }

    .up-cards-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.65rem;
    }

    .up-card-desk {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto auto auto;
        grid-template-areas:
            "identity"
            "strategy"
            "panel"
            "warns";
        gap: 0.55rem;
    }

    .up-desk-identity,
    .up-desk-strategy,
    .up-desk-panel,
    .up-desk-warns,
    .up-desk-feedback {
        grid-column: 1;
    }

    .up-desk-identity {
        grid-area: identity;
        display: grid;
        grid-template-columns: 64px minmax(0, 1fr);
        gap: 0.45rem;
        align-items: start;
        overflow: hidden;
    }

    .up-desk-portrait {
        width: 64px;
        height: 64px;
    }

    .up-desk-strategy {
        grid-area: strategy;
    }

    .up-desk-panel {
        grid-area: panel;
    }

    .up-desk-warns {
        grid-area: warns;
    }

    .up-desk-feedback {
        font-size: 0.67rem;
        color: #d5e9ff;
        border-top: 1px dashed rgba(0, 212, 255, 0.25);
        padding-top: 0.3rem;
    }

}

@media (min-width: 1200px) {
    /* Keep Unit branch tabs aligned with shifted main content
       when desktop sidebar is expanded in MainLayout. */
    .layout-pc.sidebar-expanded .up-bottom-tabs {
        left: calc(300px + 0.75rem);
        width: calc(100% - 300px - 1.5rem);
    }
}

/* Shared tab row with cg-tabs */
.cg-tabs.up-bottom-tabs {
    gap: var(--s-2);
}

.up-tab-btn.active {
    border-color: var(--accent-primary) !important;
    color: var(--accent-primary) !important;
    box-shadow: var(--glow);
}

/* === Unit Production v3 — mockup layout === */
.up-v3 {
    --up-teal: #26ced1;
    --up-teal-dim: rgba(38, 206, 209, 0.15);
    --up-teal-border: rgba(38, 206, 209, 0.35);
    --up-teal-glow: rgba(38, 206, 209, 0.45);
    --up-panel-bg: rgba(8, 16, 28, 0.92);
    --up-text-muted: rgba(156, 178, 204, 0.95);
    padding-bottom: calc(var(--bottomnav-h, 4rem) + var(--safe-bot, 0px) + 5rem);
}

.up-v3 .glass-panel {
    border-radius: var(--cg-surface-radius);
    border-color: var(--cg-surface-border);
    background: var(--cg-surface-bg);
    box-shadow: var(--cg-surface-shadow);
}

/* Header */
.up-v3-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 1rem;
    margin-bottom: 0.65rem;
}

.up-v3-title .ui-section-title {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #e8f4ff;
}

.up-v3-header-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.up-v3-stat-pill {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(38, 206, 209, 0.22);
    background: rgba(6, 14, 26, 0.85);
    min-width: 7.5rem;
}

.up-v3-stat-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    flex-shrink: 0;
}

.up-v3-stat-glyph {
    font-size: 1rem;
    color: var(--up-teal);
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.up-v3-stat-body {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
}

.up-v3-stat-label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--up-text-muted);
    white-space: nowrap;
}

.up-v3-stat-value {
    font-size: 0.88rem;
    font-weight: 800;
    color: #eef8ff;
    line-height: 1.1;
}

.up-v3-collect-all {
    border-radius: 8px;
    border: 1px solid rgba(125, 255, 179, 0.55);
    background: rgba(125, 255, 179, 0.08);
    color: #7dffb3;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.55rem 1rem;
    white-space: nowrap;
    transition: box-shadow 160ms ease, background 160ms ease;
}

.up-v3-collect-all:hover:not(:disabled) {
    background: rgba(125, 255, 179, 0.16);
    box-shadow: 0 0 16px rgba(125, 255, 179, 0.22);
}

.up-v3-collect-all:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Page body */
.up-v3 .up-page-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.65rem;
    align-items: start;
}

.up-v3 .up-content {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 0;
    min-width: 0;
}

/* Tier progression */
.up-v3-tier-section {
    padding: 0.75rem 0.85rem 0.85rem;
}

.up-v3-tier-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.up-v3-tier-head-left {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.up-v3-branch-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.up-v3-branch-name {
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    color: var(--up-teal);
}

.up-v3-branch-sub {
    font-size: 0.65rem;
    color: var(--up-text-muted);
    margin-top: 0.1rem;
}

.up-v3-compare-btn {
    border-radius: 8px;
    border: 1px solid rgba(38, 206, 209, 0.28);
    background: rgba(38, 206, 209, 0.06);
    color: rgba(180, 220, 240, 0.85);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.35rem 0.65rem;
    white-space: nowrap;
}

.up-v3-compare-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.up-v3-tier-track {
    display: flex;
    align-items: stretch;
    gap: 0;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
}

.up-v3-tier-arrow {
    display: flex;
    align-items: center;
    padding: 0 0.15rem;
    color: var(--up-teal);
    font-size: 0.85rem;
    opacity: 0.7;
    flex-shrink: 0;
    align-self: center;
}

.up-v3-tier-card {
    flex: 1 1 0;
    min-width: 7.5rem;
    max-width: 11rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.28rem;
    padding: 0.55rem 0.45rem 0.5rem;
    border-radius: var(--cg-surface-radius);
    border: 1px solid var(--cg-surface-border);
    background: var(--cg-surface-bg);
    cursor: pointer;
    box-shadow: var(--cg-surface-shadow);
    transition: transform var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
    text-align: center;
}

.up-v3-tier-card:hover {
    transform: translateY(-2px);
    border-color: var(--cg-surface-border-hover);
    box-shadow: var(--cg-surface-shadow-hover);
}

.up-v3-tier-card.selected {
    border-color: var(--cg-surface-border-selected);
    box-shadow: var(--cg-surface-shadow-hover);
    background: var(--cg-surface-bg);
}

.up-v3-tier-card.locked {
    opacity: 0.72;
}

.up-v3-tier-card.locked .up-v3-tier-portrait {
    filter: grayscale(0.85) brightness(0.65);
}

.up-v3-tier-badge {
    align-self: flex-start;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--up-teal);
    background: rgba(38, 206, 209, 0.12);
    border: 1px solid rgba(38, 206, 209, 0.3);
    border-radius: 4px;
    padding: 0.08rem 0.28rem;
}

.up-v3-tier-portrait {
    width: 52px;
    height: 52px;
    object-fit: contain;
    margin: 0.1rem 0;
}

.up-v3-tier-name {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--up-teal);
    line-height: 1.2;
}

.up-v3-tier-meta {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
    font-size: 0.58rem;
    color: var(--up-text-muted);
    width: 100%;
}

.up-v3-tier-action {
    width: 100%;
    margin-top: 0.15rem;
    border-radius: 6px;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.28rem 0.35rem;
    border: none;
    cursor: pointer;
}

.up-v3-tier-action.train {
    background: rgba(38, 206, 209, 0.15);
    color: rgba(38, 206, 209, 0.7);
    border: 1px solid rgba(38, 206, 209, 0.25);
}

.up-v3-tier-action.train.active {
    background: linear-gradient(135deg, #1eb8bb, #26ced1);
    color: #031018;
    border-color: transparent;
    box-shadow: 0 0 12px rgba(38, 206, 209, 0.35);
}

.up-v3-tier-action.train:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.up-v3-tier-action.locked {
    background: rgba(80, 90, 110, 0.25);
    color: rgba(160, 170, 190, 0.8);
    border: 1px solid rgba(120, 130, 150, 0.3);
    cursor: default;
}

/* Detail panel */
.up-v3-detail {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0;
    overflow: hidden;
    align-items: stretch;
}

.up-v3-detail.locked .up-v3-detail-portrait {
    filter: grayscale(0.7) brightness(0.7);
}

.up-v3-detail-portrait-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    padding: 0.65rem;
    background: linear-gradient(180deg, rgba(4, 12, 22, 0.6), rgba(8, 20, 36, 0.9));
    border-right: 1px solid rgba(38, 206, 209, 0.12);
}

.up-v3-detail-portrait {
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    object-fit: none;
    display: block;
    flex-shrink: 0;
}

.up-v3-detail-body {
    padding: 0.85rem 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 0;
}

.up-v3-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.up-v3-detail-name {
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    color: var(--up-teal);
    margin: 0;
    line-height: 1.15;
}

.up-v3-detail-desc {
    font-size: 0.72rem;
    color: var(--up-text-muted);
    margin: 0.25rem 0 0;
    line-height: 1.4;
    max-width: 28rem;
}

.up-v3-detail-tier-badge {
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--up-teal);
    background: rgba(38, 206, 209, 0.1);
    border: 1px solid rgba(38, 206, 209, 0.35);
    border-radius: 6px;
    padding: 0.25rem 0.55rem;
    white-space: nowrap;
}

.up-v3-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem 0.65rem;
}

.up-v3-stat-cell {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.45rem;
    border-radius: 8px;
    border: 1px solid rgba(38, 206, 209, 0.14);
    background: rgba(4, 12, 24, 0.55);
    min-width: 0;
}

.up-v3-stat-cell-ic {
    font-size: 0.85rem;
    opacity: 0.9;
}

.up-v3-stat-cell-token {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.up-v3-stat-cell-lbl {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--up-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.up-v3-stat-cell-val {
    font-size: 0.72rem;
    font-weight: 800;
    color: #eef6ff;
    text-align: right;
    white-space: nowrap;
}

.up-v3-resource-line {
    font-size: 0.65rem;
    color: rgba(180, 210, 235, 0.9);
    padding: 0.3rem 0.45rem;
    border-radius: 6px;
    background: rgba(38, 206, 209, 0.05);
    border: 1px dashed rgba(38, 206, 209, 0.18);
}

.up-v3-qty-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem 1rem;
}

.up-v3-qty-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--up-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.up-v3-qty-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.up-v3-qty-btn {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 8px;
    border: 1px solid rgba(38, 206, 209, 0.45);
    background: rgba(38, 206, 209, 0.12);
    color: var(--up-teal);
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
    padding: 0;
}

.up-v3-qty-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.up-v3-qty-input {
    width: 3.5rem;
    height: 1.75rem;
    border-radius: 8px;
    border: 1px solid rgba(38, 206, 209, 0.45);
    background: rgba(38, 206, 209, 0.08);
    color: #eef8ff;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 800;
    padding: 0 0.2rem;
}

.up-v3-qty-input::-webkit-outer-spin-button,
.up-v3-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.up-v3-qty-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.up-v3-qty-max {
    border-radius: 8px;
    border: 1px solid rgba(125, 255, 179, 0.5);
    background: rgba(125, 255, 179, 0.1);
    color: #7dffb3;
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    padding: 0.35rem 0.55rem;
    text-transform: uppercase;
}

.up-v3-token-total {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.68rem;
    color: var(--up-text-muted);
    margin-left: auto;
}

.up-v3-token-total-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.up-v3-token-total strong {
    color: #eef8ff;
}

.up-v3-train-btn {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 0.65rem 1rem;
    font-size: 0.82rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #031018;
    background: linear-gradient(135deg, #1eb8bb, #26ced1);
    box-shadow: 0 0 24px rgba(38, 206, 209, 0.35);
    transition: filter 160ms ease, box-shadow 160ms ease;
}

.up-v3-train-btn:hover:not(:disabled) {
    filter: brightness(1.06);
    box-shadow: 0 0 32px rgba(38, 206, 209, 0.5);
}

.up-v3-train-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.up-v3-total-time {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: var(--up-text-muted);
}

.up-v3-total-time-ic {
    opacity: 0.8;
}

.up-v3-warn {
    font-size: 0.65rem;
    font-weight: 800;
    color: #ffc107;
}

.up-v3-locked-panel {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-start;
}

.up-v3-unlock-btn {
    border-radius: 8px;
    border: 1px solid rgba(255, 193, 7, 0.55);
    background: rgba(255, 193, 7, 0.12);
    color: #ffd34f;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.45rem 0.75rem;
}

.up-v3-unlock-reason {
    font-size: 0.65rem;
    color: rgba(255, 214, 120, 0.95);
    margin: 0;
}

.up-v3-footnote,
.up-v3-queue-footnote {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    font-size: 0.62rem;
    color: rgba(140, 170, 200, 0.85);
    margin: 0.15rem 0 0;
    line-height: 1.35;
}

.up-v3-footnote-ic {
    flex-shrink: 0;
    opacity: 0.75;
}

/* Production queue sidebar */
.up-v3-queue {
    display: none;
    padding: 0.75rem 0.85rem;
    flex-direction: column;
    gap: 0.55rem;
}

.up-v3-queue-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.up-v3-queue-title {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--up-teal);
}

.up-v3-queue-skull {
    font-size: 0.85rem;
    opacity: 0.85;
}

.up-v3-queue-count {
    font-size: 0.72rem;
    font-weight: 800;
    color: rgba(180, 220, 245, 0.95);
}

.up-v3-queue-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.up-v3-queue-item {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.55rem 0.6rem;
    border-radius: var(--cg-surface-radius);
    border: 1px solid var(--cg-surface-border);
    background: var(--cg-surface-bg);
    box-shadow: var(--cg-surface-shadow);
    min-height: 4.5rem;
}

.up-v3-queue-item.active {
    border-color: var(--cg-surface-border-selected);
    box-shadow: var(--cg-surface-shadow-hover);
}

.up-v3-queue-item.empty {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-style: dashed;
    border-color: var(--cg-surface-border);
    background: color-mix(in srgb, var(--bg-surface-1) 50%, transparent);
    min-height: 5.5rem;
}

.up-v3-queue-empty-icon {
    font-size: 1.4rem;
    font-weight: 300;
    color: rgba(38, 206, 209, 0.5);
    line-height: 1;
}

.up-v3-queue-empty-title {
    font-size: 0.72rem;
    font-weight: 800;
    color: rgba(200, 225, 245, 0.9);
    margin-top: 0.2rem;
}

.up-v3-queue-empty-hint {
    font-size: 0.6rem;
    color: var(--up-text-muted);
    margin-top: 0.1rem;
}

.up-v3-queue-thumb {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid rgba(38, 206, 209, 0.25);
    background: rgba(38, 206, 209, 0.06);
    flex-shrink: 0;
}

.up-v3-queue-info {
    flex: 1;
    min-width: 0;
}

.up-v3-queue-name {
    font-size: 0.75rem;
    font-weight: 800;
    color: #e8f6ff;
    line-height: 1.2;
}

.up-v3-queue-progress {
    width: 100%;
    height: 6px;
    margin-top: 0.35rem;
    border-radius: 999px;
    overflow: hidden;
}

.up-v3-queue-progress::-webkit-progress-bar {
    background: rgba(38, 206, 209, 0.12);
    border-radius: 999px;
}

.up-v3-queue-progress::-webkit-progress-value {
    background: linear-gradient(90deg, #1a9fa2, #26ced1);
    border-radius: 999px;
}

.up-v3-queue-status {
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(160, 190, 220, 0.85);
    margin-top: 0.2rem;
}

.up-v3-queue-remain {
    font-size: 0.62rem;
    color: var(--up-text-muted);
    margin-top: 0.15rem;
}

/* Mobile queue strip */
.up-v3-mobile-queue {
    display: block;
    margin-top: 0.65rem;
}

/* Bottom tabs — mockup style */
.up-v3 .up-bottom-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    border-top: 1px solid rgba(38, 206, 209, 0.15);
    background: rgba(6, 12, 22, 0.96);
    backdrop-filter: blur(12px);
    padding: 0.35rem 0.5rem;
}

.up-v3 .up-tab-btn {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    border: none;
    border-radius: 0;
    background: transparent;
    border-bottom: 2px solid transparent;
    padding: 0.5rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: rgba(140, 165, 195, 0.85);
}

.up-v3 .up-tab-btn.active {
    color: var(--up-teal) !important;
    border-bottom-color: var(--up-teal) !important;
    box-shadow: none !important;
    background: transparent !important;
}

.up-v3 .up-tab-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* Desktop layout */
@media (min-width: 1024px) {
    .up-v3 {
        padding: 0.75rem 0.85rem calc(var(--bottomnav-h, 0px) + 4.5rem);
    }

    .up-v3 .up-page-body {
        grid-template-columns: minmax(0, 1fr) 16.5rem;
        gap: 0.75rem;
    }

    .up-v3-queue {
        display: flex;
        position: sticky;
        top: 0.75rem;
        align-self: start;
        max-height: calc(100vh - 8rem);
        overflow-y: auto;
    }

    .up-v3-mobile-queue {
        display: none !important;
    }

    .up-v3-header {
        position: sticky;
        top: 0;
        z-index: 50;
    }

    .up-v3-stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1023px) {
    .up-v3-header {
        grid-template-columns: 1fr;
        gap: 0.55rem;
    }

    .up-v3-header-stats {
        justify-content: flex-start;
    }

    .up-v3-collect-all {
        width: 100%;
    }

    .up-v3-detail {
        grid-template-columns: 1fr;
    }

    .up-v3-detail-portrait-wrap {
        border-right: none;
        border-bottom: 1px solid rgba(38, 206, 209, 0.12);
        padding: 0.75rem;
    }

    .up-v3-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .up-v3-token-total {
        margin-left: 0;
        width: 100%;
    }
}

/* Mobile: glue the branch switcher directly above the bottom nav as one compact horizontal row */
@media (max-width: 767px) {
    .up-v3 .up-bottom-tabs {
        left: 0;
        right: 0;
        bottom: calc(var(--bottomnav-h, 56px) + var(--safe-bot, 0px));
        border-radius: 0;
        border-top: 1px solid rgba(38, 206, 209, 0.2);
        padding: 0.25rem 0.4rem;
        gap: 0.25rem;
    }

    .up-v3 .up-tab-btn {
        padding: 0.4rem 0.25rem;
        font-size: 0.62rem;
        letter-spacing: 0.06em;
        gap: 0.3rem;
    }

    .up-v3 .up-tab-icon {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 640px) {
    .up-v3-stat-pill {
        min-width: 0;
        flex: 1 1 calc(50% - 0.3rem);
    }

    .up-v3-header-stats {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .up-v3-stat-pill:last-child {
        grid-column: 1 / -1;
    }
}

