/* Surface and hero layout */

:root {
    --craft-card-radius: var(--bs-border-radius-xl, 1.25rem);
    --craft-hero-shadow: var(--bs-box-shadow-lg, 0 1.5rem 3rem rgb(0 0 0 / 20%));
    --craft-hero-bg: linear-gradient(
        135deg,
        rgba(var(--bs-primary-rgb), 0.92) 0%,
        rgba(var(--bs-secondary-rgb, var(--bs-primary-rgb)), 0.85) 100%
    );
    --craft-hero-fg: var(--bs-light, #f8f9fa);
    --craft-hero-muted: rgba(var(--bs-light-rgb), 0.75);
    --craft-glass-bg: rgba(var(--bs-light-rgb), 0.12);
    --craft-glass-border: rgba(var(--bs-light-rgb), 0.28);
    --craft-glass-shadow: 0 20px 48px -18px rgb(17 24 39 / 45%);
    --craft-warning-bg: var(--bs-warning-bg-subtle, rgba(var(--bs-warning-rgb), 0.16));
    --craft-warning-border: var(--bs-warning-border-subtle, rgba(var(--bs-warning-rgb), 0.38));
    --craft-warning-text: var(--bs-warning-text-emphasis, var(--bs-warning));
    --craft-cta-gradient: linear-gradient(
        135deg,
        rgba(var(--bs-warning-rgb), 0.9),
        rgba(var(--bs-danger-rgb), 0.85)
    );
}

html[data-theme="darkly"] {
    --craft-hero-shadow: 0 1.5rem 3rem rgb(0 0 0 / 45%);
    --craft-hero-muted: rgba(var(--bs-light-rgb), 0.65);
    --craft-glass-bg: rgba(var(--bs-light-rgb), 0.18);
    --craft-glass-border: rgba(var(--bs-light-rgb), 0.35);
    --craft-glass-shadow: 0 22px 52px -18px rgb(0 0 0 / 65%);
}

/* Hide html scrollbar on craft page, keep only .nav-padding scrollbar */
html:has(#craftMainTabs) {
    overflow: hidden !important;
}

.craft-bp-surface {
    background: transparent;
}

/* Ensure craft main tabs only scroll horizontally if needed */
#craftMainTabs.craft-nav-tabs {
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

#craftMainTabs {
    overflow-y: hidden !important;
}

/* Ensure craft page doesn't create additional scroll contexts */
.craft-bp-surface,
.craft-bp-surface * {
    overflow-y: visible !important;
    overflow-x: visible !important;
    max-height: none !important;
    height: auto !important;
}

/* Hide inactive tab panes completely to avoid taking up space */
.tab-pane.fade:not(.show) {
    display: none !important;
}

/* Stronger scoping for redesigned craft tabs: only show the active pane */
.craft-tab-content > .tab-pane:not(.active) {
    display: none !important;
}
.craft-tab-content > .tab-pane.active {
    display: block;
}

.craft-hero {
    background: var(--craft-hero-bg);
    border-radius: var(--craft-card-radius);
    box-shadow: var(--craft-hero-shadow);
    color: var(--craft-hero-fg);
    padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1rem, 3vw, 2rem);
}

.dev-alert {
    border-radius: calc(var(--craft-card-radius) - 0.35rem);
    border: 1px solid var(--craft-warning-border);
    background: var(--craft-warning-bg);
    color: var(--craft-warning-text);
    box-shadow: 0 10px 24px rgba(var(--bs-warning-rgb), 0.18);
}

.dev-alert i {
    color: rgba(var(--bs-warning-rgb), 0.9);
}

.craft-hero .header-bg {
    color: rgba(var(--bs-light-rgb), 0.22);
    font-size: clamp(6rem, 12vw, 8rem);
}

html[data-theme="darkly"] .craft-hero .header-bg {
    color: rgba(var(--bs-light-rgb), 0.18);
}

.craft-hero__content {
    position: relative;
    z-index: 1;
}

.blueprint-icon {
    width: 68px;
    height: 68px;
    border-radius: calc(var(--craft-card-radius) - 0.5rem);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bs-light-rgb), 0.18);
    border: 1px solid rgba(var(--bs-light-rgb), 0.35);
    backdrop-filter: blur(6px);
}

.blueprint-icon img {
    width: 60px;
    height: 60px;
    border-radius: calc(var(--craft-card-radius) - 0.75rem);
    object-fit: cover;
    background: rgba(var(--bs-light-rgb), 0.25);
}

.blueprint-icon .fallback {
    display: none;
    align-items: center;
    justify-content: center;
    color: rgba(var(--bs-light-rgb), 0.9);
    font-size: 1.5rem;
    width: 100%;
    height: 100%;
}

/* Shared EVE type icon sizing (avoid inline styles in templates) */
.eve-type-icon {
    object-fit: cover;
    background: var(--bs-tertiary-bg, var(--bs-secondary-bg));
}

.eve-type-icon--30 {
    width: 30px;
    height: 30px;
}

.eve-type-icon--28 {
    width: 28px;
    height: 28px;
}

.hero-eyebrow {
    letter-spacing: 0.18em;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--craft-hero-muted);
}

.hero-title i {
    color: rgba(var(--bs-light-rgb), 0.82);
}

.hero-title {
    font-size: clamp(2rem, 4vw, 2.75rem);
    color: var(--craft-hero-fg);
}

.hero-subtitle {
    font-size: clamp(0.95rem, 2.2vw, 1.1rem);
    color: var(--craft-hero-muted);
}

.hero-chip-row {
    gap: 0.65rem;
}

.hero-headline {
    flex-wrap: wrap;
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: rgba(var(--bs-light-rgb), 0.12);
    border: 1px solid rgba(var(--bs-light-rgb), 0.24);
    color: rgba(var(--bs-light-rgb), 0.92);
    backdrop-filter: blur(6px);
    font-size: 0.85rem;
    flex: 1 1 180px;
}

.hero-chip i {
    color: rgba(var(--bs-light-rgb), 0.95);
}

.hero-chip-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.65rem;
    color: rgba(var(--bs-light-rgb), 0.7);
}

.hero-chip-value {
    font-weight: 700;
    color: var(--craft-hero-fg);
}

.hero-kpi-row {
    gap: 1.5rem;
}

.hero-kpi {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.85rem 1.1rem;
    border-radius: 1rem;
    background: rgba(var(--bs-light-rgb), 0.14);
    border: 1px solid rgba(var(--bs-light-rgb), 0.25);
    min-width: 160px;
}

.hero-kpi.positive {
    border-color: rgba(var(--bs-success-rgb), 0.55);
    background: linear-gradient(
        135deg,
        rgba(var(--bs-primary-rgb), 0.18),
        rgba(var(--bs-success-rgb), 0.24)
    );
}

.hero-kpi.negative {
    border-color: rgba(var(--bs-danger-rgb), 0.55);
    background: linear-gradient(
        135deg,
        rgba(var(--bs-warning-rgb), 0.2),
        rgba(var(--bs-danger-rgb), 0.24)
    );
}

.hero-kpi-label {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.65rem;
    color: rgba(var(--bs-light-rgb), 0.7);
}

.hero-kpi-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--craft-hero-fg);
}

.glass-panel {
    background: var(--craft-glass-bg);
    border-radius: 1.25rem;
    border: 1px solid var(--craft-glass-border);
    backdrop-filter: blur(12px);
    box-shadow: var(--craft-glass-shadow);
    color: rgba(var(--bs-light-rgb), 0.95);
}

.hero-panel-title {
    letter-spacing: 0.18em;
}

.hero-action-buttons .btn {
    border-radius: 999px;
    font-weight: 600;
    border-width: 1px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hero-action-buttons .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.28);
}

#recalcNowBtn {
    background: var(--craft-cta-gradient);
    border: none;
}

#recalcNowBtn.pulse {
    animation: recalcPulse 0.6s ease;
}

@keyframes recalcPulse {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
    }
    50% {
        transform: translateY(-2px) scale(1.05);
        box-shadow: 0 18px 35px rgba(249, 115, 22, 0.35);
    }
    100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
    }
}

#simulationStatus {
    font-weight: 600;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
}

#bpTabs-loading {
    border-radius: 1.25rem;
    border: 1px solid rgb(250 204 21 / 40%) !important;
    background: linear-gradient(135deg, #fff7d6, #fee4a4) !important;
    box-shadow: 0 14px 32px rgb(250 204 21 / 35%);
}

.blueprint-main {
    position: relative;
    z-index: 2;
}

@media (max-width: 991.98px) {
    .craft-hero__panel {
        margin-top: 1rem;
    }

    .hero-headline {
        flex-direction: column;
    }

    .hero-kpi {
        min-width: calc(50% - 0.75rem);
    }

    .hero-chip {
        flex: 1 1 calc(50% - 0.75rem);
        justify-content: flex-start;
    }

    .blueprint-tabs {
        gap: 0.75rem !important;
    }

    .blueprint-tab {
        min-height: 86px;
        padding: 0.7rem 0.85rem;
    }
}

@media (max-width: 575.98px) {
    .hero-chip {
        flex: 1 1 100%;
    }

    .hero-kpi {
        min-width: 100%;
    }

    .blueprint-tabs {
        gap: 0.6rem !important;
        padding-bottom: 0.25rem;
    }

    .blueprint-tab {
        min-height: 80px;
        padding: 0.65rem 0.75rem;
    }

    .blueprint-tab .tab-title {
        font-size: 0.95rem;
    }

    .blueprint-tab .tab-subtitle {
        font-size: 0.65rem;
    }
}

/* Enhanced tree styling */
details {
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
    border-left: 2px solid var(--bs-border-color);
}

details summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

details summary:hover {
    background-color: var(--bs-secondary-bg);
}

.summary-icon i {
    display: inline-block;
    transition: transform 0.2s ease-in-out;
}

details[open] summary .summary-icon i {
    transform: rotate(90deg);
}

/* Blueprint navigation */
.blueprint-tabs {
    gap: 1rem !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

/* Keep the tab rail available while scrolling through large tables. */
.craft-tabs-sticky {
    position: sticky;
    top: 0;
    z-index: 20;
    padding-top: 0.25rem;
    background: linear-gradient(
        to bottom,
        rgba(var(--bs-body-bg-rgb), 0.98),
        rgba(var(--bs-body-bg-rgb), 0.92)
    );
    backdrop-filter: blur(6px);
}

.craft-tabs-sticky::after {
    content: "";
    display: block;
    height: 1px;
    background: var(--bs-border-color);
    opacity: 0.6;
    margin-top: 0.35rem;
}

.blueprint-tab {
    background: var(--bs-body-bg);
    border-radius: 1.25rem;
    border: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-align: left;
    min-height: 96px;
    box-shadow: 0 10px 24px rgb(15 23 42 / 10%);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    flex: 0 0 auto;
    width: auto;
}

.blueprint-tab:focus {
    outline: 2px solid rgba(79, 140, 255, 0.4);
    outline-offset: 2px;
}

.blueprint-tab .tab-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(79, 140, 255, 0.14);
    color: #3b82f6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.blueprint-tab .tab-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    line-height: 1.2;
}

.blueprint-tab .tab-title {
    font-weight: 600;
    font-size: 1rem;
}

.blueprint-tab .tab-subtitle {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.blueprint-tab:not(.active):hover {
    transform: translateY(-4px);
    border-color: rgba(79, 140, 255, 0.4);
    box-shadow: 0 16px 32px rgb(15 23 42 / 14%);
}

.blueprint-tab.active {
    color: #fff;
    box-shadow: 0 18px 36px rgb(79 140 255 / 30%);
    transform: translateY(-3px);
    border-color: transparent;
}

.blueprint-tab.active .tab-subtitle {
    color: rgba(var(--bs-light-rgb), 0.75);
}

html[data-theme="darkly"] .blueprint-tab.active .tab-subtitle {
    color: rgba(var(--bs-light-rgb), 0.85);
}

.blueprint-tab.active .tab-icon {
    background: rgba(var(--bs-light-rgb), 0.18);
    color: #fff;
}

html[data-theme="darkly"] .blueprint-tab.active .tab-icon {
    background: rgba(var(--bs-primary-rgb), 0.18);
    color: var(--bs-light);
}

#materials-tab.blueprint-tab .tab-icon { background: rgba(2, 132, 199, 0.13); color: #0369a1; }
#tree-tab.blueprint-tab .tab-icon { background: rgba(22, 163, 74, 0.14); color: #15803d; }
#cycles-tab.blueprint-tab .tab-icon { background: rgba(100, 116, 139, 0.14); color: #475569; }
#financial-tab.blueprint-tab .tab-icon { background: rgba(251, 191, 36, 0.18); color: #b45309; }
#needed-tab.blueprint-tab .tab-icon { background: rgba(2, 132, 199, 0.13); color: #0369a1; }
#config-tab.blueprint-tab .tab-icon { background: rgba(220, 38, 38, 0.16); color: #b91c1c; }

#materials-tab.blueprint-tab.active { background: linear-gradient(135deg, #0284c7, #38bdf8); }
#tree-tab.blueprint-tab.active { background: linear-gradient(135deg, #16a34a, #4ade80); }
#cycles-tab.blueprint-tab.active { background: linear-gradient(135deg, #334155, #64748b); }
#financial-tab.blueprint-tab.active { background: linear-gradient(135deg, #facc15, #fbbf24); color: var(--bs-body-color); }
#financial-tab.blueprint-tab.active .tab-title,
#financial-tab.blueprint-tab.active .tab-subtitle,
#financial-tab.blueprint-tab.active .tab-icon { color: var(--bs-body-color); }
#needed-tab.blueprint-tab.active { background: linear-gradient(135deg, #0ea5e9, #38bdf8); }
#config-tab.blueprint-tab.active { background: linear-gradient(135deg, #dc2626, #fb7185); }
#financial-tab.blueprint-tab.active .tab-icon {
    background: rgba(var(--bs-light-rgb), 0.32);
}

html[data-theme="darkly"] #financial-tab.blueprint-tab.active .tab-icon {
    background: rgba(var(--bs-warning-rgb), 0.22);
}

/* Tab intro cards */
.card-intro {
    background: linear-gradient(135deg, rgba(241, 245, 249, 0.9), rgba(var(--bs-body-bg-rgb, 255, 255, 255), 0.95));
    border: 1px solid rgba(203, 213, 225, 0.8) !important;
    border-radius: 1.1rem !important;
}

html[data-theme="darkly"] .card-intro {
    background: linear-gradient(135deg, rgba(var(--bs-body-bg-rgb, 15, 23, 42), 0.92), rgba(var(--bs-body-bg-rgb, 15, 23, 42), 0.96));
    border-color: rgba(var(--bs-light-rgb), 0.15) !important;
}

.card-intro .card-body {
    padding: 1.25rem 1.5rem;
}

.tab-intro-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.tab-intro h3 {
    letter-spacing: 0.1em;
}

/* Compact per-tab header (replaces the intro cards for denser data views). */
.craft-pane-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    margin-bottom: 0.85rem;
    border-radius: 1rem;
    border: 1px solid var(--bs-border-color);
    background: rgba(var(--bs-body-bg-rgb), 0.7);
}

.craft-pane-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex: 0 0 auto;
}

.craft-pane-title {
    margin: 0;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--bs-secondary-color);
}

.craft-pane-subtitle {
    margin: 0.15rem 0 0;
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
}

@media (max-width: 575.98px) {
    .craft-pane-head {
        align-items: flex-start;
    }
}

/* Harmonisation des backgrounds pour chaque onglet CraftBP */

#tab-materials .card,
#tab-tree .card,
#tab-cycles .card,
#tab-financial .card,
#tab-needed .card,
#tab-config .card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgb(15 23 42 / 12%);
}

/* Card headers avec les couleurs correspondantes aux nav-items mais plus claires */
#tab-materials .card-header {
    background: linear-gradient(90deg, #38bdf8 0%, #7dd3fc 100%) !important;
    color: #fff !important;
    border-bottom: none !important;
}

#tab-tree .card-header {
    background: linear-gradient(90deg, #4ade80 0%, #86efac 100%) !important;
    color: #fff !important;
    border-bottom: none !important;
}

#tab-cycles .card-header {
    background: linear-gradient(90deg, #94a3b8 0%, #cbd5e1 100%) !important;
    color: #fff !important;
    border-bottom: none !important;
}

#tab-financial .card-header {
    background: linear-gradient(90deg, #fcd34d 0%, #fde68a 100%) !important;
    color: var(--bs-body-color) !important;
    border-bottom: none !important;
}

#tab-needed .card-header {
    background: linear-gradient(90deg, #38bdf8 0%, #7dd3fc 100%) !important;
    color: #fff !important;
    border-bottom: none !important;
}

#tab-config .card-header {
    background: linear-gradient(90deg, #fb7185 0%, #fca5a5 100%) !important;
    color: #fff !important;
    border-bottom: none !important;
}

/* Financial tab column width standardization */
#tab-financial .table {
    table-layout: fixed;
    width: 100%;
}

input.real-price.is-manual,
input.sale-price-unit.is-manual {
    background: #fff7ed;
    border-color: #fb923c !important;
    box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.18);
    color: #9a3412;
}

html[data-theme="darkly"] input.real-price.is-manual,
html[data-theme="darkly"] input.sale-price-unit.is-manual {
    background: rgba(var(--bs-body-bg-rgb), 0.8);
    border-color: #fb923c !important;
    color: var(--bs-body-color);
}

#tab-financial tr.has-manual {
    background: rgba(251, 191, 36, 0.11);
}

#tab-financial tr.has-manual td {
    position: relative;
}

#tab-financial tr.has-manual td:first-child::before {
    content: attr(data-manual-label);
    position: absolute;
    top: -0.6rem;
    left: 0;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    background: rgba(251, 191, 36, 0.9);
    color: #78350f;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    box-shadow: 0 6px 14px rgba(180, 83, 9, 0.22);
}

#tab-financial tr.has-manual td:first-child:not([data-manual-label])::before {
    content: "Manual";
}

#tab-financial .table th,
#tab-financial .table td {
    width: 20%; /* 5 colonnes = 20% chacune */
    word-wrap: break-word;
    overflow-wrap: break-word;
    vertical-align: middle;
}

#tab-financial .table thead th {
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 1;
}

html[data-theme="darkly"] #tab-financial .table thead th {
    background: rgba(var(--bs-body-bg-rgb), 0.88);
}

/* Specific adjustment for the first column (item name), which can be wider */
#tab-financial .table th:first-child,
#tab-financial .table td:first-child {
    width: 30%;
    min-width: 200px; /* Minimum width for long names */
}

/* The other columns share the remaining space */
#tab-financial .table th:not(:first-child),
#tab-financial .table td:not(:first-child) {
    width: 17.5%; /* (100% - 30%) / 4 = 17.5% */
}

/* Style for item name badges */
#tab-financial .badge {
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    word-break: break-word;
    line-height: 1.2;
}

/* Improvement for badges with very long text */
#tab-financial .badge:hover {
    white-space: normal;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    z-index: 1000;
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Ensure the table stays readable with long names */
#tab-financial .table-responsive {
    overflow-x: auto;
    min-height: 200px;
}

/* Responsive behavior for small screens */
@media (max-width: 768px) {
    #tab-financial .table {
        table-layout: auto; /* Back to auto layout on mobile */
    }

    #tab-financial .table th,
    #tab-financial .table td {
        width: auto;
        min-width: 80px;
    }
}

/* Production cycles tab enhancements */
#tab-cycles .cycles-enhanced {
    background: #fefefe;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

html[data-theme="darkly"] #tab-cycles .cycles-enhanced {
    background: rgba(var(--bs-body-bg-rgb), 0.88);
}

#tab-cycles .cycles-overview {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.15), rgba(148, 163, 184, 0));
}

#tab-cycles .cycles-stat-tile {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

html[data-theme="darkly"] #tab-cycles .cycles-stat-tile {
    background: rgba(var(--bs-body-bg-rgb), 0.85);
    border-color: rgba(var(--bs-light-rgb), 0.15);
}

#tab-cycles .cycles-stat-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

#tab-cycles .cycles-stat-label {
    letter-spacing: 0.08em;
    font-size: 0.7rem;
}

#tab-cycles .cycles-stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--bs-body-color);
}

#tab-cycles .cycles-stat-meta {
    font-size: 0.8rem;
}

#tab-cycles .cycles-toolbar {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

#tab-cycles .cycles-toolbar .btn {
    border-radius: 8px;
}

#tab-cycles .filters-row input {
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.3);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

#tab-cycles .filters-row input:focus {
    background: #ffffff;
    border-color: #64748b;
    box-shadow: 0 0 0 0.2rem rgba(100, 116, 139, 0.25);
}

#tab-cycles #cycles-table tbody tr {
    transition: background 0.15s ease;
}

#tab-cycles #cycles-table tbody tr:hover {
    background: rgba(148, 163, 184, 0.12);
}

#tab-cycles .cycles-insights {
    background: #f1f5f9;
}

html[data-theme="darkly"] #tab-cycles .cycles-insights {
    background: rgba(var(--bs-body-bg-rgb), 0.82);
}

#tab-cycles .cycles-insight-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

html[data-theme="darkly"] #tab-cycles .cycles-insight-card {
    background: rgba(var(--bs-body-bg-rgb), 0.88);
    border-color: rgba(var(--bs-light-rgb), 0.15);
}

#tab-cycles .cycles-insight-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

.cursor-pointer {
    cursor: pointer !important;
}

.badge-cycle {
    background: linear-gradient(135deg, #38bdf8, #6366f1);
}

.badge-output {
    background: linear-gradient(135deg, #4ade80, #22c55e);
}

.badge-surplus {
    background: linear-gradient(135deg, #fcd34d, #f97316);
    color: #7c2d12;
}

#tab-cycles .cycles-insight-card .badge {
    font-size: 0.85rem;
}

#tab-cycles .cycles-insight-card .text-muted {
    color: var(--indy-text-secondary, #475569) !important;
}

html[data-theme="darkly"] #tab-cycles .cycles-insight-card .text-muted {
    color: rgba(var(--bs-light-rgb), 0.7) !important;
}

/* Bootstrap utility classes overrides */
html[data-theme="darkly"] .bg-body-tertiary,
html[data-theme="darkly"] .bg-body-secondary,
html[data-theme="darkly"] .bg-light,
html[data-theme="darkly"] .bg-white {
    background-color: #303030 !important;
}

html[data-theme="darkly"] [class*="subtle"] {
    background-color: #303030 !important;
}

/* ==========================================================================
 * Merged from craft_bp_redesigned.css (2026-01-10)
 * ========================================================================== */

/* Craft BP Redesigned - 3 Column Layout
 *
 * FEATURES FOR COMPLEX BLUEPRINTS:
 * - Max-height + scroll on all major sections to prevent overwhelming data
 * - Collapsible material groups (click header to expand/collapse)
 * - Expand/Collapse all buttons for materials
 * - Responsive 3-column → 1-column layout
 * - Custom scrollbars for better UX
 *
 * SCROLL LIMITS:
 * - Materials list: 500px
 * - Material group items: 300px
 * - Production Tree: 600px
 * - Blueprint Config: 750px
 * - Financial table: 500px
 * - Shopping list: 400px
 */

/* HIDE LEGACY TAB SYSTEM - Force hidden for backward compatibility */
#bpTabs,
#bpTabs.nav,
#bpTabs.nav-pills,
#bpTabs.blueprint-tabs,
div[id="bpTabs"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
}

#bpTabsContent,
.tab-content[id="bpTabsContent"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
}

/* Hide any remaining tab elements */
.nav.nav-pills#bpTabs,
.blueprint-tabs#bpTabs {
    display: none !important;
}

.blueprint-tab {
    /* Allow styling for hidden elements only */
}

.craft-layout-3col {
    display: grid !important;
    grid-template-columns: 1fr 380px 1fr !important;
    gap: 1.5rem !important;
    align-items: start !important;
    width: 100% !important;
}

/* Responsive Breakpoints */
@media (max-width: 1400px) {
    .craft-layout-3col {
        grid-template-columns: 1fr 350px 1fr !important;
        gap: 1rem !important;
    }
}

@media (max-width: 1200px) {
    .craft-layout-3col {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .craft-col {
        order: 0 !important;
    }

    .craft-col-config {
        order: 2 !important;
    }

    .craft-col-analysis {
        order: 3 !important;
    }
}

@media (max-width: 768px) {
    .craft-layout-3col {
        gap: 1rem !important;
    }

    .craft-header-compact {
        flex-direction: column !important;
        gap: 1rem !important;
    }

    .craft-header-left {
        flex-direction: column !important;
        width: 100% !important;
    }

    .craft-header-runs {
        width: 100% !important;
    }
}

/* Column Styling */
.craft-col {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
    min-width: 0 !important;
}

.craft-col-planning {
    /* Left column - Materials, Tree, Cycles */
}

.craft-col-config {
    /* Center column - Config */
    min-width: 0 !important;
}

.craft-col-analysis {
    /* Right column - Financial, Shopping */
}

/* Section Styling */
.craft-section {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.craft-section-title {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--bs-body-color);
    margin: 0;
    padding: 0 0.5rem;
}

.craft-section-header-with-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.craft-section-header-with-actions .craft-section-title {
    flex: 1;
    margin: 0;
}

.craft-section-controls {
    display: flex;
    gap: 0.25rem;
}

/* KPI Row */
.craft-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
}

.craft-kpi {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 0.75rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.craft-kpi-sm {
    padding: 0.5rem;
}

.craft-kpi-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.25px;
    color: var(--bs-secondary);
}

.craft-kpi-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bs-body-color);
    word-break: break-word;
}

/* Materials List */
.craft-materials-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-x: hidden;
}

.craft-materials-list::-webkit-scrollbar {
    width: 6px;
}

.craft-materials-list::-webkit-scrollbar-track {
    background: var(--bs-tertiary-bg);
    border-radius: 3px;
}

.craft-materials-list::-webkit-scrollbar-thumb {
    background: var(--bs-border-color);
    border-radius: 3px;
}

.craft-materials-list::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary-color);
}

.craft-group-card {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    overflow: hidden;
    transition: all 0.2s ease;
}

.craft-group-toggle {
    transition: transform 0.2s ease;
    font-size: 0.75rem;
}

.craft-group-card.collapsed .craft-group-toggle {
    transform: rotate(-90deg);
}

.craft-group-card.collapsed .craft-group-items {
    display: none;
}

.craft-group-header {
    background: var(--bs-secondary-bg);
    padding: 0.625rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.craft-group-header:hover {
    background: var(--bs-tertiary-bg);
}

.craft-group-items {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.craft-group-items::-webkit-scrollbar {
    width: 4px;
}

.craft-group-items::-webkit-scrollbar-thumb {
    background: var(--bs-border-color);
    border-radius: 2px;
}

.craft-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0.5rem;
    border-radius: 0.25rem;
    background: var(--bs-body-bg);
    font-size: 0.8125rem;
}

.craft-item-row:hover {
    background: var(--bs-secondary-bg);
}

.craft-item-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.craft-item-name .badge {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tree Container */
.craft-tree-container {
    font-size: 0.85rem;
    overflow-x: hidden;
}

.craft-tree-container::-webkit-scrollbar {
    width: 6px;
}

.craft-tree-container::-webkit-scrollbar-track {
    background: var(--bs-tertiary-bg);
    border-radius: 3px;
}

.craft-tree-container::-webkit-scrollbar-thumb {
    background: var(--bs-border-color);
    border-radius: 3px;
}

.craft-tree-container::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary-color);
}

.craft-tree-item {
    padding: 0.25rem 0;
}

/* Collapsible */
.craft-collapsible {
    margin: 0;
    padding: 0;
}

.craft-collapsible-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.craft-collapsible-header:hover {
    background: var(--bs-tertiary-bg);
}

.craft-collapsible[open] .craft-collapsible-header {
    border-radius: 0.375rem 0.375rem 0 0;
    border-bottom: none;
}

.craft-collapsible-body {
    border: 1px solid var(--bs-border-color);
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    padding: 0.75rem;
}

/* Config */
#blueprintConfigAccordion::-webkit-scrollbar {
    width: 6px;
}

#blueprintConfigAccordion::-webkit-scrollbar-track {
    background: var(--bs-tertiary-bg);
    border-radius: 3px;
}

#blueprintConfigAccordion::-webkit-scrollbar-thumb {
    background: var(--bs-border-color);
    border-radius: 3px;
}

#blueprintConfigAccordion::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary-color);
}

.craft-config-level {
    margin-bottom: 1rem;
}

.craft-config-level:last-child {
    margin-bottom: 0;
}

.craft-config-level-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--bs-secondary);
    margin-bottom: 0.5rem;
}

.craft-config-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.craft-config-item {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 0.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    align-items: center;
    background: var(--bs-secondary-bg);
}

.craft-config-name {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
}

.craft-config-name .small {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.craft-config-inputs {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.craft-config-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.craft-config-field label {
    font-weight: 600;
    color: var(--bs-secondary);
}

.craft-config-field input {
    font-size: 0.75rem;
}

/* Financial Table */
.craft-financial-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.craft-financial-table-header h4 {
    margin: 0;
}

.craft-financial-actions {
    display: flex;
    gap: 0.25rem;
}

.craft-financial-table {
    font-size: 0.8125rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
}

.craft-financial-table::-webkit-scrollbar {
    width: 6px;
}

.craft-financial-table::-webkit-scrollbar-track {
    background: var(--bs-tertiary-bg);
    border-radius: 3px;
}

.craft-financial-table::-webkit-scrollbar-thumb {
    background: var(--bs-border-color);
    border-radius: 3px;
}

.craft-financial-table::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary-color);
}

.craft-financial-table table {
    margin-bottom: 0;
    width: 100%;
    table-layout: fixed; /* enables predictable column sizing + ellipsis */
}

/* Purchase Planner column sizing: keep numeric columns readable, let Item take the remaining space */
.craft-financial-table .col-qty {
    width: clamp(70px, 7vw, 95px);
}

.craft-financial-table .col-fuzzwork {
    width: clamp(110px, 10vw, 145px);
}

.craft-financial-table .col-real {
    width: clamp(110px, 10vw, 145px);
}

.craft-financial-table .col-total {
    width: clamp(125px, 11vw, 170px);
}

.craft-financial-table .col-margin {
    width: clamp(90px, 8vw, 130px);
}

.craft-financial-table th,
.craft-financial-table td {
    overflow: hidden;
}

.craft-financial-table th.text-end,
.craft-financial-table td.text-end {
    white-space: nowrap;
}

/* Item column should truncate when space is tight */
.craft-planner-item-flex {
    min-width: 0; /* critical for flex truncation */
}

.craft-planner-item-name-wrap {
    min-width: 0;
    flex: 1 1 auto;
    text-align: left;
}

/* The badge itself should not stretch; it truncates within the available width */
.craft-planner-item-name {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.craft-financial-table input[type="number"] {
    font-size: 0.75rem;
    padding: 0.25rem 0.375rem;
    height: 1.875rem;
}

.craft-financial-table input.readonly {
    background-color: var(--bs-secondary-bg) !important;
    border-color: var(--bs-border-color) !important;
}

.craft-financial-table td {
    padding: 0.5rem 0.375rem;
    vertical-align: middle;
}

.craft-financial-table .text-xs {
    font-size: 0.75rem;
}

/* Slightly larger table text (requested: +20%) */
.craft-financial-table.craft-table-text-120 .text-xs {
    font-size: 0.9rem; /* 0.75 * 1.2 */
}

.craft-financial-table.craft-table-text-120 input[type="number"] {
    font-size: 0.9rem; /* 0.75 * 1.2 */
}

.craft-financial-table input {
    max-width: 100%;
}

/* Needed Table */
.craft-needed-table {
    font-size: 0.8125rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
}

.craft-needed-table::-webkit-scrollbar {
    width: 6px;
}

.craft-needed-table::-webkit-scrollbar-track {
    background: var(--bs-tertiary-bg);
    border-radius: 3px;
}

.craft-needed-table::-webkit-scrollbar-thumb {
    background: var(--bs-border-color);
    border-radius: 3px;
}

.craft-needed-table::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary-color);
}

.craft-needed-table table {
    margin-bottom: 0;
}

.craft-needed-table td {
    padding: 0.5rem 0.375rem;
}

.craft-needed-table .text-xs {
    font-size: 0.75rem;
}

/* Cycles table (build tab) +20% */
.craft-cycles-table.craft-table-text-120 .text-xs {
    font-size: 0.9rem; /* 0.75 * 1.2 */
}

/* Header Compact */
.craft-header-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    padding: 1rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.craft-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.craft-header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.craft-header-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bs-secondary-bg);
    border-radius: 0.375rem;
    overflow: hidden;
}

.craft-header-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.craft-header-icon .fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-secondary);
}

.craft-header-text {
    flex: 1;
    min-width: 0;
}

.craft-header-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.craft-header-subtitle {
    font-size: 0.8125rem;
    color: var(--bs-secondary);
    margin: 0;
}

.craft-header-runs {
    display: flex;
    gap: 0.5rem;
}

.craft-header-runs .input-group {
    white-space: nowrap;
}

.craft-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Utils */
.text-xs {
    font-size: 0.75rem;
}

.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Profit percentage inside the blue "Net Profit" row: keep contrast, avoid "muted" blue-on-blue */
.profit-pct {
    color: inherit;
    opacity: 0.75;
    font-weight: 600;
}

/* Eve Type Icons */
.eve-type-icon {
    border: 1px solid var(--bs-border-color);
}

.eve-type-icon--20 {
    width: 20px;
    height: 20px;
}

.eve-type-icon--28 {
    width: 28px;
    height: 28px;
}

.eve-type-icon--30 {
    width: 30px;
    height: 30px;
}

/* Bootstrap overrides for dark theme compatibility */
html[data-theme="darkly"] .craft-section {
    background: #1a1a1a;
    border-color: #333;
}

html[data-theme="darkly"] .craft-kpi {
    background: #2a2a2a;
    border-color: #333;
}

html[data-theme="darkly"] .craft-group-header {
    background: #2a2a2a;
}

html[data-theme="darkly"] .craft-item-row:hover {
    background: #2a2a2a;
}

html[data-theme="darkly"] .craft-header-icon {
    background: #2a2a2a;
}

/* ==========================================================================
 * Merged from craft_bp_tabs.css (2026-01-10)
 * ========================================================================== */

/* Craft BP - Modern 3-Tab Layout */

/* ========== MODERN TAB NAVIGATION ========== */
.craft-tabs-modern {
    margin-bottom: 2rem;
}

.craft-tab-content {
    min-height: auto;
    max-height: none;
    overflow: visible;
}

.craft-nav-tabs {
    display: flex;
    align-items: center;
    border-bottom: 2px solid var(--bs-border-color);
    gap: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    background: transparent;
    padding: 0;
    margin-bottom: 1.5rem;
}

.craft-nav-tabs .nav-link {
    position: relative;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--bs-body-color);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 1rem 1.5rem;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    border-radius: 0;
}

.craft-nav-tabs .nav-link:hover {
    color: var(--bs-primary);
    border-bottom-color: var(--bs-primary);
    background: transparent;
}

.craft-nav-tabs .nav-link.active {
    color: var(--bs-primary);
    border-bottom-color: var(--bs-primary);
    background: transparent;
    font-weight: 700;
}

.craft-nav-tabs .nav-link i {
    font-size: 1.15rem;
    opacity: 0.9;
}

.craft-nav-tabs .nav-link.active i {
    opacity: 1;
}

.craft-tab-content {
    padding: 1.5rem 0 0 0;
}

/* Override inner scroll/height constraints from legacy styles */
.craft-materials-list,
.craft-group-items,
.craft-tree-container,
.craft-config-items,
.craft-financial-table,
.craft-needed-table {
    max-height: none !important;
    overflow-y: visible !important;
}

/* Ensure inactive panes do not occupy space */
.tab-content > .tab-pane:not(.active) {
    display: none !important;
}

/* ========== QUICK STATS CARDS ========== */
.craft-quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.craft-stat-card {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
}

.craft-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.craft-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.craft-stat-content {
    flex: 1;
    min-width: 0;
}

.craft-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--bs-secondary);
    margin-bottom: 0.25rem;
}

.craft-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--bs-body-color);
    word-break: break-word;
}

/* ========== PROGRESS INDICATORS ========== */
.craft-progress-section {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.craft-progress-item {
    margin-bottom: 1rem;
}

.craft-progress-item:last-child {
    margin-bottom: 0;
}

.craft-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.craft-progress-percent {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--bs-primary);
}

.craft-progress-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--bs-secondary-bg);
}

.craft-progress-bar .progress-bar {
    border-radius: 4px;
}

/* ========== SEARCH SECTION ========== */
.craft-search-section {
    margin-bottom: 1.5rem;
}

.craft-search-section .input-group-text {
    background: var(--bs-body-bg);
    border-right: none;
}

.craft-search-section .form-control {
    border-left: none;
}

.craft-search-section .form-control:focus {
    border-left: none;
    box-shadow: none;
}

.craft-search-section .form-control:focus + .input-group-text {
    border-color: var(--bs-primary);
}

/* ========== DASHBOARD 2-COLUMN LAYOUT ========== */
.craft-dashboard-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.craft-dashboard-col {
    min-width: 0;
}

@media (max-width: 1200px) {
    .craft-dashboard-columns {
        grid-template-columns: 1fr;
    }
}

/* ========== FINANCIAL HERO ========== */
.craft-financial-hero {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    color: var(--bs-body-color);
}

.craft-financial-hero .craft-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.craft-financial-hero .craft-kpi {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
}

.craft-financial-hero .craft-kpi-label {
    color: var(--bs-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.craft-financial-hero .craft-kpi-value {
    color: var(--bs-body-color);
    font-size: 1.5rem;
    font-weight: 700;
}

/* ========== BULK ACTIONS ========== */
.craft-bulk-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.craft-bulk-group {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 1rem;
}

.craft-bulk-group .form-label {
    margin-bottom: 0.5rem;
    color: var(--bs-body-color);
}

/* ========== RESPONSIVE ADJUSTMENTS ========== */
@media (max-width: 768px) {
    .craft-nav-tabs .nav-link {
        padding: 0.875rem 1.25rem;
        font-size: 0.875rem;
    }

    .craft-nav-tabs .nav-link i {
        font-size: 1rem;
    }

    .craft-quick-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .craft-stat-card {
        padding: 0.75rem;
    }

    .craft-stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .craft-stat-value {
        font-size: 1rem;
    }

    .craft-financial-hero {
        padding: 1.5rem;
    }

    .craft-financial-hero .craft-kpi-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .craft-financial-hero .craft-kpi {
        padding: 1rem;
    }

    .craft-financial-hero .craft-kpi-value {
        font-size: 1.25rem;
    }

    .craft-bulk-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .craft-quick-stats {
        grid-template-columns: 1fr;
    }

    .craft-financial-hero .craft-kpi-row {
        grid-template-columns: 1fr;
    }
}

/* ========== FINANCIAL TABLE ENHANCEMENTS ========== */
.craft-financial-table .item-margin {
    font-weight: 600;
}

.craft-financial-table .item-margin.positive {
    color: var(--bs-success);
}

.craft-financial-table .item-margin.negative {
    color: var(--bs-danger);
}

/* ========== CONFIG ACCORDION ENHANCEMENTS - CARD GRID LAYOUT ========== */
.craft-config-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.craft-bp-card {
    transition: all 0.3s ease;
    border: 2px solid var(--bs-border-color);
    border-radius: 0.75rem;
    overflow: hidden;
}

.craft-bp-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    border-color: var(--bs-primary);
}

.craft-bp-card .card-header {
    border-bottom: 2px solid var(--bs-border-color);
    position: relative;
    padding: 0.75rem !important;
}

.craft-bp-icon {
    width: 64px;
    height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.craft-bp-card .card-title {
    font-size: 0.95rem;
    line-height: 1.3;
    color: var(--bs-body-color);
    overflow-wrap: break-word;
}

.craft-efficiency-controls {
    width: 100%;
}

.efficiency-group label {
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.efficiency-group .input-group {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.efficiency-group .form-control {
    font-size: 1.5rem;
    height: auto;
    padding: 0.75rem 0.5rem;
    border-width: 2px;
}

.efficiency-group .input-group-text {
    font-size: 1rem;
    font-weight: 700;
    background: var(--bs-secondary-bg);
    border-width: 2px;
}

/* Blueprint sharing section */
.blueprint-sharing-section {
    border-top: 1px solid var(--bs-border-color);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

.blueprint-sharing-section .alert {
    font-size: 0.875rem;
    margin-bottom: 0;
}

.blueprint-sharing-section .btn-sm {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
}

.blueprint-sharing-section .form-select-sm {
    font-size: 0.875rem;
}

/* Legacy items support (if any remain) */
.craft-config-items {
    display: grid;
    gap: 1.25rem;
}

.craft-config-item {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    transition: all 0.2s ease;
    border: 2px solid var(--bs-border-color);
}

.craft-config-item.card {
    background: var(--bs-body-bg);
    border-radius: 0.5rem;
    overflow: hidden;
}

.craft-config-item.card:hover {
    border-color: var(--bs-primary);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.craft-config-item .card-body {
    width: 100%;
    padding: 1.25rem !important;
}

.craft-config-name {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.craft-config-name .eve-type-icon--64 {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.craft-config-inputs {
    display: flex;
    gap: 2rem;
    flex-shrink: 0;
    align-items: flex-end;
}

.craft-config-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 120px;
}

.craft-config-field label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--bs-secondary);
    margin: 0;
    letter-spacing: 0.5px;
}

.craft-config-field .input-group-lg .form-control {
    height: auto;
    padding: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    min-width: 80px;
}

.craft-config-field .input-group-text {
    font-weight: 700;
    font-size: 0.9rem;
    background: var(--bs-secondary-bg);
}

.craft-config-field input {
    width: 70px;
}

/* ========== BULK ACTIONS IMPROVEMENTS ========== */
.craft-bulk-actions {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.craft-bulk-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.craft-bulk-group .btn-group {
    flex: 1;
}

.craft-bulk-group .btn {
    flex: 1;
    font-size: 0.875rem;
}

.craft-bulk-group .input-group {
    gap: 0.5rem;
}

.craft-bulk-group .btn-primary {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
}

.craft-bulk-group .btn-primary:hover {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    filter: brightness(1.1);
}

/* ========== SEARCH IMPROVEMENTS ========== */
#blueprintSearchInput {
    border-radius: 0.375rem 0 0 0.375rem;
}

#blueprintSearchInput::placeholder {
    color: var(--bs-secondary);
    opacity: 0.7;
}

#clearSearch {
    border-radius: 0 0.375rem 0.375rem 0;
}

#clearSearch:hover {
    background: var(--bs-danger);
    border-color: var(--bs-danger);
    color: white;
}

/* Hide items that don't match search */
.craft-bp-card[style*="display: none"],
.craft-config-item[style*="display: none"] {
    display: none !important;
}

.accordion-item[style*="display: none"] {
    display: none !important;
}

/* Blueprint ownership styling - Card version */
.craft-bp-card[data-blueprint-not-owned="true"] {
    border-color: rgba(255, 193, 7, 0.6);
}

.craft-bp-card[data-blueprint-not-owned="true"]:hover {
    border-color: var(--bs-warning);
    box-shadow: 0 8px 16px rgba(255, 193, 7, 0.25);
}

.craft-bp-card[data-blueprint-not-owned="true"] .efficiency-group input {
    background-color: rgba(255, 193, 7, 0.08);
    border-color: rgba(255, 193, 7, 0.4) !important;
}

.craft-bp-card[data-blueprint-not-owned="true"] .efficiency-group input:focus {
    background-color: rgba(255, 193, 7, 0.12);
    border-color: var(--bs-warning) !important;
    box-shadow: 0 0 0 0.25rem rgba(255, 193, 7, 0.15);
}

/* Legacy item styling for not owned */
.craft-config-item[data-blueprint-not-owned="true"] {
    opacity: 1;
    border-color: rgba(255, 193, 7, 0.5);
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.03) 0%, transparent 100%);
}

.craft-config-item[data-blueprint-not-owned="true"] .card-body::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--bs-warning) 0%, rgba(255, 193, 7, 0.6) 100%);
}

.craft-config-item[data-blueprint-not-owned="true"] .card-body {
    position: relative;
    padding-left: 1.5rem !important;
}

.craft-config-item[data-blueprint-not-owned="true"] .craft-config-inputs input {
    background-color: rgba(255, 193, 7, 0.08);
    border-color: rgba(255, 193, 7, 0.4) !important;
}

html[data-theme="darkly"] .craft-bp-card[data-blueprint-not-owned="true"] .efficiency-group input {
    background-color: rgba(255, 193, 7, 0.1);
    border-color: rgba(255, 193, 7, 0.5) !important;
}

html[data-theme="darkly"] .craft-config-item[data-blueprint-not-owned="true"] .craft-config-inputs input {
    background-color: rgba(255, 193, 7, 0.1);
    border-color: rgba(255, 193, 7, 0.5) !important;
}

.craft-section-header-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.craft-section-header-with-actions .craft-section-title {
    margin: 0;
}

/* Toast notification styling */
.toast {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.bg-success {
    background: var(--bs-success) !important;
}

.toast.bg-danger {
    background: var(--bs-danger) !important;
}

/* ========== DARK THEME ADJUSTMENTS ========== */
html[data-theme="darkly"] .craft-stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

html[data-theme="darkly"] .craft-search-section .input-group-text {
    background: var(--bs-tertiary-bg);
}

html[data-theme="darkly"] .craft-bulk-actions {
    background: var(--bs-secondary-bg);
    padding: 1.5rem;
    border-radius: 0.375rem;
}

html[data-theme="darkly"] #blueprintSearchInput {
    background: var(--bs-body-bg);
    border-color: var(--bs-border-color);
}
