/* Buildings Dashboard — compact mobile-first layout */

.bld-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--s-3) var(--s-3) var(--s-8);
}

/* ── Resource strip ── */
.bld-resources {
    display: flex;
    gap: var(--s-2);
    overflow-x: auto;
    padding-bottom: var(--s-2);
    margin-bottom: var(--s-3);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.bld-resources::-webkit-scrollbar { display: none; }

.bld-res-item {
    flex: 1 0 auto;
    min-width: 88px;
    background: var(--bg-surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bld-res-top {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.bld-res-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex-shrink: 0;
}

.bld-res-amount {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
}

.bld-res-income {
    font-size: 10px;
    font-weight: 600;
    color: var(--status-success);
}

/* ── Layout: main + sidebar ── */
.bld-layout {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
}

@media (min-width: 1100px) {
    .bld-layout {
        flex-direction: row;
        align-items: flex-start;
        gap: var(--s-5);
    }

    .bld-main { flex: 1; min-width: 0; }
    .bld-sidebar {
        display: flex;
        flex-direction: column;
        gap: var(--s-3);
        width: 280px;
        flex-shrink: 0;
        position: sticky;
        top: var(--s-3);
    }
}

.bld-sidebar { display: none; }

@media (min-width: 1100px) {
    .bld-sidebar { display: flex; }
}

/* ── Header ── */
.bld-header {
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    margin-bottom: var(--s-3);
}

.bld-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-2);
}

.bld-title {
    font-size: 20px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--s-2);
}

.bld-title-info {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent-primary) 20%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent-primary) 40%, transparent);
    color: var(--accent-primary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.bld-actions {
    width: 100%;
}

.bld-quick-actions {
    width: 100%;
}

.bld-quick-actions--desktop {
    display: none;
}

.bld-quick-actions__label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: var(--s-2);
}

.bld-quick-actions--mobile .bld-quick-actions__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: var(--s-2);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(12, 18, 28, 0.72), rgba(8, 12, 20, 0.88));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.bld-work-alert {
    margin-top: var(--s-2);
    padding: 0.55rem 0.65rem;
    border-radius: 6px;
    font-size: 0.78rem;
    line-height: 1.35;
    font-weight: 600;
    background: rgba(201, 162, 39, 0.12);
    border: 1px solid rgba(201, 162, 39, 0.45);
    color: #f0d878;
}

.bld-quick-actions--mobile .bld-action-img-btn {
    width: 100%;
}

.bld-quick-actions--mobile .bld-action-img-btn img {
    width: 100%;
    max-width: none;
    max-height: none;
    object-fit: contain;
}

.bld-action-btn--full {
    width: 100%;
    justify-content: center;
}

.bld-action-btn {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    border: 1px solid;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: opacity var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
    white-space: nowrap;
}

.bld-action-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.bld-action-btn--collect {
    background: color-mix(in srgb, var(--status-success) 22%, transparent);
    border-color: var(--status-success);
    color: #4ade80;
}

.bld-action-btn--boost {
    background: color-mix(in srgb, var(--accent-primary) 18%, transparent);
    border-color: var(--accent-primary);
    color: #60a5fa;
}

.bld-action-btn--fix {
    background: color-mix(in srgb, var(--accent-gold) 15%, transparent);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.bld-action-btn--tokens {
    background: color-mix(in srgb, var(--accent-gold) 12%, transparent);
    border-color: color-mix(in srgb, var(--accent-gold) 60%, transparent);
    color: var(--accent-gold);
}

.bld-action-img-btn {
    position: relative;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    line-height: 0;
    transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease), filter var(--dur-base) var(--ease);
}

.bld-action-img-btn img {
    height: auto;
    width: auto;
    max-height: 40px;
    max-width: min(100%, 200px);
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}

.bld-action-img-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

.bld-action-img-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.35);
}

.bld-action-img-btn__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.95);
    color: #1a1208;
    font-size: 9px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

.bld-action-sub {
    font-size: 10px;
    font-weight: 700;
    opacity: 0.9;
}

/* ── Global status bar ── */
.bld-status-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-2);
    background: var(--bg-surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: var(--s-2) var(--s-3);
    margin-bottom: var(--s-3);
}

@media (min-width: 600px) {
    .bld-status-bar { grid-template-columns: repeat(4, 1fr); }
}

.bld-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bld-stat-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.bld-stat-value {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary);
}

.bld-stat-value--warn { color: #f87171; }
.bld-stat-value--ok { color: #4ade80; }
.bld-stat-value--muted { color: var(--text-muted); }

/* ── Category tabs ── */
.bld-cat-tabs {
    display: flex;
    gap: var(--s-1);
    overflow-x: auto;
    margin-bottom: var(--s-3);
    scrollbar-width: none;
    padding-bottom: 2px;
}

.bld-cat-tabs::-webkit-scrollbar { display: none; }

.bld-cat-tab {
    flex: 1 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface-1);
    color: var(--text-muted);
    transition: all var(--dur-base) var(--ease);
}

.bld-cat-tab-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex-shrink: 0;
}

.bld-cat-tab.on {
    background: color-mix(in srgb, var(--accent-primary) 20%, transparent);
    border-color: var(--accent-primary);
    color: #93c5fd;
}

.bld-cat-tab--economy.on {
    background: color-mix(in srgb, #22c55e 18%, transparent);
    border-color: #22c55e;
    color: #4ade80;
}

.bld-cat-tab--military.on {
    background: color-mix(in srgb, #ef4444 18%, transparent);
    border-color: #ef4444;
    color: #f87171;
}

.bld-cat-tab--others.on {
    background: color-mix(in srgb, #3b82f6 18%, transparent);
    border-color: #3b82f6;
    color: #60a5fa;
}

.bld-cat-tab--all.on {
    background: color-mix(in srgb, var(--accent-primary) 18%, transparent);
    border-color: var(--accent-primary);
    color: #93c5fd;
}

.bld-cat-tab-count {
    opacity: 0.7;
    margin-left: 4px;
}

/* ── Sections ── */
.bld-section {
    margin-bottom: var(--s-5);
}

.bld-section-head {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    margin-bottom: var(--s-2);
    padding-bottom: var(--s-1);
    border-bottom: 1px solid var(--border-subtle);
}

.bld-section-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

.bld-section-title {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 0;
}

.bld-section--economy .bld-section-title { color: #4ade80; }
.bld-section--military .bld-section-title { color: #f87171; }
.bld-section--others .bld-section-title { color: #60a5fa; }

.bld-section-count {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-surface-2, rgba(0,0,0,0.3));
    padding: 2px 8px;
    border-radius: 10px;
}

.bld-section-cards {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}

/* Tablet+: grid tiles */
@media (min-width: 700px) {
    .bld-section-cards--grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--s-3);
        align-items: stretch;
    }

    /* Economy has 4 buildings — 2×2 on tablet, 4 in row on wide desktop */
    .bld-section-cards--economy {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bld-section-cards--grid > .bld-card {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        height: 100%;
        min-height: 260px;
        padding: 0;
        gap: 0;
    }

    .bld-section-cards--grid .bld-card-hero {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 11;
        min-height: 110px;
        flex-shrink: 0;
        align-self: stretch;
        align-items: flex-end;
        justify-content: center;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        background: linear-gradient(180deg, rgba(18, 26, 42, 0.98) 0%, rgba(6, 10, 18, 1) 55%, rgba(4, 8, 14, 1) 100%);
        padding: 6px 10px 0;
    }

    .bld-section-cards--grid .bld-card-hero img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: center bottom;
    }

    .bld-section-cards--grid .bld-card-panel {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        padding: var(--s-3);
        gap: var(--s-2);
    }

    .bld-section-cards--grid .bld-card-body,
    .bld-section-cards--grid .bld-card-panel {
        justify-content: flex-start;
    }

    .bld-section-cards--grid .bld-card-actions {
        flex-direction: row;
        width: 100%;
        max-width: none;
        min-width: 0;
        gap: var(--s-2);
        margin-top: auto;
        padding-top: var(--s-1);
    }

    .bld-section-cards--grid .bld-btn {
        flex: 1;
        padding: 10px 10px;
        font-size: 10px;
        min-height: 48px;
        justify-content: center;
    }

    .bld-section-cards--grid .bld-card-lvl {
        bottom: 8px;
        right: 8px;
        font-size: 11px;
        padding: 2px 8px;
    }
}

/* ── Desktop (PC mockup layout) ── */
@media (min-width: 1100px) {
    .bld-dashboard {
        max-width: none;
        padding: var(--s-4) var(--s-5) var(--s-10);
    }

    /* Resources already in global top bar */
    .bld-resources { display: none; }

    .bld-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--s-3) var(--s-4);
        margin-bottom: var(--s-3);
        padding-bottom: var(--s-3);
        border-bottom: 1px solid var(--border-subtle);
    }

    .bld-header-top { flex: 0 0 auto; }

    .bld-title { font-size: 26px; }

    .bld-actions {
        width: auto;
        flex: 1 1 auto;
    }

    .bld-quick-actions--mobile {
        display: none;
    }

    .bld-quick-actions--desktop {
        display: block;
        width: auto;
    }

    .bld-quick-actions--desktop .bld-quick-actions__grid {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: flex-end;
        gap: var(--s-2);
    }

    .bld-quick-actions--desktop .bld-action-img-btn img {
        width: auto;
        max-height: 44px;
        max-width: 220px;
        object-fit: contain;
    }

    .bld-action-btn {
        padding: 10px 18px;
        font-size: 12px;
    }

    .bld-action-img-btn img {
        max-height: 44px;
        max-width: 220px;
    }

    .bld-status-bar {
        margin-bottom: var(--s-4);
        padding: var(--s-3) var(--s-4);
    }

    .bld-stat-label { font-size: 10px; }
    .bld-stat-value { font-size: 15px; }

    .bld-cat-tabs {
        gap: var(--s-2);
        margin-bottom: var(--s-5);
        overflow: visible;
        flex-wrap: wrap;
    }

    .bld-cat-tab {
        flex: 0 0 auto;
        padding: 10px 20px;
        font-size: 12px;
    }

    .bld-section { margin-bottom: var(--s-6); }

    .bld-section-head {
        margin-bottom: var(--s-3);
        padding-bottom: var(--s-2);
    }

    .bld-section-title { font-size: 13px; }

    .bld-section-cards--grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .bld-section-cards--economy {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .bld-section-cards--grid > .bld-card {
        min-height: 280px;
    }

    .bld-section-cards--grid .bld-card-hero {
        aspect-ratio: 16 / 10;
        min-height: 130px;
        padding: 8px 12px 0;
    }

    .bld-section-cards--grid .bld-card-name { font-size: 15px; }

    .bld-section-cards--grid .bld-progress-track { height: 8px; }

    .bld-sidebar { width: 300px; }
}

/* ── Building card ── */
.bld-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: var(--s-2);
    padding: var(--s-2);
    background: var(--cg-surface-bg);
    border: 1px solid var(--cg-surface-border);
    border-radius: var(--cg-surface-radius);
    position: relative;
    overflow: hidden;
    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);
}

.bld-card:hover {
    transform: translateY(-2px);
    border-color: var(--cg-surface-border-hover);
    box-shadow: var(--cg-surface-shadow-hover);
}

.bld-card.state-full {
    background: linear-gradient(135deg, rgba(40, 10, 10, 0.4) 0%, color-mix(in srgb, var(--bg-surface-1) 70%, transparent) 100%);
}

.bld-card.state-ready {
    background: linear-gradient(135deg, rgba(10, 40, 20, 0.35) 0%, color-mix(in srgb, var(--bg-surface-1) 70%, transparent) 100%);
}

.bld-card.state-idle { opacity: 0.8; }
.bld-card.not-owned { opacity: 0.75; }

.bld-card-upgrading-overlay {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
    pointer-events: none;
    z-index: 1;
}

/* Hero / thumbnail */
.bld-card-hero {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    align-self: center;
    border-radius: 6px;
    overflow: hidden;
    background: linear-gradient(165deg, rgba(22, 30, 48, 0.95) 0%, rgba(8, 12, 22, 1) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.bld-card-hero img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center bottom;
    display: block;
}

.bld-card-hero.glow-green::after,
.bld-card-hero.glow-orange::after,
.bld-card-hero.glow-brown::after,
.bld-card-hero.glow-black::after,
.bld-card-hero.glow-red::after,
.bld-card-hero.glow-gray::after,
.bld-card-hero.glow-blue::after,
.bld-card-hero.glow-purple::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 100%, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
}

.bld-card-hero.glow-green { box-shadow: inset 0 -20px 30px rgba(34, 197, 94, 0.12); }
.bld-card-hero.glow-orange { box-shadow: inset 0 -20px 30px rgba(245, 158, 11, 0.12); }
.bld-card-hero.glow-red { box-shadow: inset 0 -20px 30px rgba(239, 68, 68, 0.12); }
.bld-card-hero.glow-blue { box-shadow: inset 0 -20px 30px rgba(59, 130, 246, 0.12); }
.bld-card-hero.glow-purple { box-shadow: inset 0 -20px 30px rgba(139, 92, 246, 0.12); }

.bld-card-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
}

.bld-card-lvl {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(251, 191, 36, 0.5);
    color: #fbbf24;
    font-size: 9px;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 3px;
    line-height: 1.3;
}

.bld-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s-1);
}

.bld-card-title-wrap {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}

.bld-card-name {
    margin: 0;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bld-card-level-text {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.bld-card-head-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.bld-status-badge {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 64px;
    height: 18px;
    padding: 0 7px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.badge-full { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
.badge-ready { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.35); }
.badge-producing { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.35); }
.badge-idle { background: rgba(107, 114, 128, 0.15); color: #9ca3af; border: 1px solid rgba(107, 114, 128, 0.3); }
.badge-building { background: rgba(59, 130, 246, 0.15); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.35); }

.bld-info-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    font-size: 11px;
    cursor: pointer;
    flex-shrink: 0;
}

.bld-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bld-meta-rate {
    font-size: 12px;
    font-weight: 800;
    color: #fbbf24;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.bld-meta-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex-shrink: 0;
}

.bld-btn-res-icon {
    width: 12px;
    height: 12px;
    object-fit: contain;
    vertical-align: -2px;
}

.bld-meta-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
}

.bld-meta-queue {
    font-size: 10px;
    font-weight: 700;
    color: #4ade80;
}

/* Progress */
.bld-progress-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.bld-progress-track {
    height: 6px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.bld-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.bld-progress-fill.status-green { background: linear-gradient(90deg, #22c55e, #16a34a); }
.bld-progress-fill.status-orange { background: linear-gradient(90deg, #f97316, #ea580c); }
.bld-progress-fill.status-full { background: linear-gradient(90deg, #ef4444, #dc2626); }
.bld-progress-fill.status-blue { background: linear-gradient(90deg, #3b82f6, #2563eb); }

.bld-storage-text {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Actions column */
.bld-card-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
    min-width: 80px;
    max-width: 100px;
}

.bld-btn {
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    border: 1px solid;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    text-align: center;
    line-height: 1.2;
    transition: opacity var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}

.bld-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.bld-btn--collect {
    background: color-mix(in srgb, #22c55e 30%, transparent);
    border-color: rgba(34, 197, 94, 0.6);
    color: #4ade80;
}

.bld-btn:hover:not(:disabled),
.bld-action-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.bld-btn--upgrade {
    background: color-mix(in srgb, #fbbf24 18%, transparent);
    border-color: rgba(251, 191, 36, 0.5);
    color: #fbbf24;
}

.bld-btn--manage {
    background: color-mix(in srgb, var(--accent-primary) 20%, transparent);
    border-color: rgba(59, 130, 246, 0.5);
    color: #93c5fd;
}

.bld-btn--purchase {
    background: color-mix(in srgb, #22c55e 20%, transparent);
    border-color: rgba(34, 197, 94, 0.45);
    color: #4ade80;
}

.bld-btn-sub {
    font-size: 8px;
    font-weight: 700;
    opacity: 0.9;
}

.bld-btn-token {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.bld-btn-token-img {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

/* ── Sidebar panels ── */
.bld-panel {
    background: var(--bg-surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: var(--s-3);
}

.bld-panel-title {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 0 0 var(--s-2);
}

.bld-panel-row {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    margin-bottom: var(--s-2);
}

.bld-panel-row:last-child { margin-bottom: 0; }

.bld-panel-res-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex-shrink: 0;
}

.bld-panel-res-info {
    flex: 1;
    min-width: 0;
}

.bld-panel-res-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
}

.bld-panel-res-rate {
    font-size: 10px;
    color: var(--status-success);
    font-weight: 600;
}

.bld-panel-bar-track {
    height: 4px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 3px;
}

.bld-panel-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.bld-panel-bar-fill.full { background: linear-gradient(90deg, #ef4444, #dc2626); }

.bld-panel-empty {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: var(--s-2) 0;
}

.bld-queue-item {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    padding: var(--s-1) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.bld-queue-item:last-child { border-bottom: none; }

.bld-queue-thumb {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: contain;
    background: rgba(0,0,0,0.3);
}

.bld-queue-info { flex: 1; min-width: 0; }

.bld-queue-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
}

.bld-queue-timer {
    font-size: 10px;
    color: var(--accent-primary);
    font-weight: 600;
}

/* Work token icons in header */
.bld-token-icons {
    display: inline-flex;
    gap: 1px;
    align-items: center;
}

.bld-token-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

/* Narrow screens: fit resource strip in viewport */
@media (max-width: 767px) {
    .bld-resources {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        overflow-x: visible;
    }

    .bld-res-item {
        min-width: 0;
        padding: 4px 4px 5px;
        gap: 1px;
        text-align: center;
        align-items: center;
    }

    .bld-res-top {
        justify-content: center;
    }

    .bld-res-label {
        display: none;
    }

    .bld-res-icon {
        width: 14px;
        height: 14px;
    }

    .bld-res-amount {
        font-size: 10px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .bld-res-income {
        font-size: 8px;
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
}

/* Mobile: icon-only category tabs + tighter page padding */
@media (max-width: 699px) {
    .bld-dashboard {
        padding-left: var(--s-2);
        padding-right: var(--s-2);
    }

    .bld-resources {
        margin-bottom: var(--s-2);
        padding-bottom: 0;
    }

    .bld-cat-tabs {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        overflow: visible;
        margin-bottom: var(--s-2);
    }

    .bld-cat-tab {
        flex: none;
        width: 100%;
        min-width: 0;
        min-height: 0;
        height: 38px;
        padding: 4px 6px;
        gap: 0;
        border-radius: 6px;
        font-size: 9px;
    }

    .bld-cat-tab:not(.bld-cat-tab--all) .bld-cat-tab-label {
        display: none;
    }

    .bld-cat-tab:not(.bld-cat-tab--all) .bld-cat-tab-icon {
        width: 18px;
        height: 18px;
    }

    .bld-cat-tab--all {
        font-size: 9px;
        letter-spacing: 0.06em;
        padding: 4px 4px;
    }

    .bld-cat-tab--all .bld-cat-tab-label {
        display: inline;
    }

    .bld-section-cards {
        gap: var(--s-3);
    }

    .bld-card {
        display: grid;
        grid-template-columns: 72px minmax(0, 1fr);
        grid-template-rows: auto auto auto auto;
        padding: 10px;
        gap: 4px 10px;
        border-radius: 12px;
        align-items: start;
    }

    .bld-card-hero {
        grid-column: 1;
        grid-row: 1 / 4;
        width: 72px;
        height: 72px;
        align-self: start;
        border-radius: 8px;
    }

    .bld-card-panel {
        display: contents;
    }

    .bld-card-head {
        grid-column: 2;
        grid-row: 1;
        align-items: center;
    }

    .bld-card-name {
        font-size: 12px;
        white-space: normal;
        line-height: 1.2;
    }

    .bld-card-level-text {
        display: none;
    }

    .bld-card-lvl {
        font-size: 10px;
        padding: 2px 6px;
    }

    .bld-card-meta {
        grid-column: 2;
        grid-row: 2;
        align-self: start;
    }

    .bld-progress-wrap {
        grid-column: 2;
        grid-row: 3;
        align-self: start;
        width: 100%;
        min-width: 0;
    }

    .bld-progress-track {
        height: 7px;
    }

    .bld-storage-text {
        font-size: 9px;
    }

    /* Cards without storage bar: tighter stack */
    .bld-card:not(:has(.bld-progress-wrap)) .bld-card-hero {
        grid-row: 1 / 3;
    }

    .bld-card:not(:has(.bld-progress-wrap)) .bld-card-actions {
        grid-row: 3;
    }

    .bld-card-actions {
        grid-column: 1 / -1;
        grid-row: 4;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 6px;
        min-width: 0;
        max-width: none;
        width: 100%;
        padding-top: 4px;
        border-top: 1px solid var(--border-subtle);
        margin-top: 2px;
    }

    .bld-btn {
        flex: 1 1 0;
        min-width: 0;
        min-height: 40px;
        padding: 8px 6px;
        font-size: 9px;
        border-radius: 6px;
    }

    .bld-btn-sub {
        font-size: 8px;
        line-height: 1.15;
    }

    .bld-status-badge {
        font-size: 8px;
        padding: 2px 5px;
    }

    .bld-info-btn {
        width: 22px;
        height: 22px;
        font-size: 10px;
    }
}

/* Legacy class aliases (info modal etc.) */
.buildings-v2-collect-all { /* kept for compatibility */ }
.buildings-v2-work-token-icons { display: inline-flex; gap: 2px; }
.buildings-v2-token-icon { width: 18px; height: 18px; object-fit: contain; }
