/* ==========================================================================
   CSS DESIGN SYSTEM - CRAFTWORLD CALCULATOR
   ========================================================================== */

/* Variables de Colores y Tokens */
:root {
    --bg-dark-purple: #12072b;
    --bg-medium-purple: #1e093c;
    --bg-light-purple: #2c0f56;

    /* Colores Neón y Acentos */
    --neon-cyan: #00ffff;
    --neon-pink: #ff5ef5;
    --neon-purple: #e056fd;
    --neon-gold: #ffbe1a;

    /* Estados */
    --profit-green: #00db64;
    --loss-red: #ff3838;
    --text-white: #ffffff;
    --text-muted: #b4a8cc;
    --text-dark: #12072b;

    /* Fuentes */
    --font-ui: 'Inter', -apple-system, sans-serif;
    --font-heading: 'Orbitron', 'Inter', -apple-system, sans-serif;

    /* Layout */
    --header-height: 64px;
    --footer-height: 72px;
}

/* Reset de Estilos Básicos */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-ui);
    background-color: var(--bg-dark-purple);
    background-image: radial-gradient(circle at 50% 50%, var(--bg-medium-purple) 0%, var(--bg-dark-purple) 100%);
    color: var(--text-white);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    padding: 0;
}

/* Grid de Fondo tipo Juego Retro */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(224, 86, 253, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(224, 86, 253, 0.03) 1px, transparent 1px);
    background-size: 24px 24px;
    z-index: -1;
    pointer-events: none;
}

/* Scrollbar Personalizado */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark-purple);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-light-purple);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--neon-purple);
}

/* ==========================================================================
   HEADER FIJO
   ========================================================================== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: rgba(18, 7, 43, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(224, 86, 253, 0.2);
    z-index: 100;
}

.header-container {
    max-width: 700px;
    height: 100%;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo {
    filter: drop-shadow(0 0 6px rgba(0, 255, 255, 0.5));
    animation: rotateCrystal 15s linear infinite;
}

@keyframes rotateCrystal {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.title-container {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 1px;
    background: linear-gradient(90deg, #ffffff 0%, var(--neon-cyan) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-subtitle {
    font-family: var(--font-heading);
    font-size: 0.6rem;
    letter-spacing: 3px;
    color: var(--neon-pink);
    font-weight: 700;
}

.header-status {
    display: flex;
    align-items: center;
    background: transparent;
    border: 0;
    padding: 0;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--profit-green);
    box-shadow: 0 0 6px var(--profit-green);
}

.status-text {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--neon-cyan);
}

/* ==========================================================================
   CONTENIDO SCROLLABLE (MAIN CONTAINER)
   ========================================================================== */
.app-content {
    max-width: 700px;
    margin: 0 auto;
    padding: calc(var(--header-height) + 16px) 16px calc(var(--footer-height) + 24px) 16px;
    width: 100%;
}

/* ==========================================================================
   COIN TRACKER
   ========================================================================== */
.coin-tracker-sec {
    margin-bottom: 16px;
}

.coin-card {
    background: rgba(43, 19, 78, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 190, 26, 0.15);
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), inset 0 0 10px rgba(255, 190, 26, 0.05);
    transition: all 0.3s ease;
}

.coin-card:hover {
    border-color: rgba(255, 190, 26, 0.35);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25), 0 0 15px rgba(255, 190, 26, 0.1);
}

.coin-info-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.coin-icon-wrapper {
    background: rgba(255, 190, 26, 0.1);
    border: 1.5px solid rgba(255, 190, 26, 0.3);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 8px rgba(255, 190, 26, 0.2);
}

.coin-meta {
    display: flex;
    flex-direction: column;
}

.coin-symbol {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--neon-gold);
    text-shadow: 0 0 8px rgba(255, 190, 26, 0.2);
}

.coin-network {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.coin-price-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.coin-price-display {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-white);
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-width: 110px;
    text-align: right;
}

.refresh-btn {
    background: rgba(224, 86, 253, 0.1);
    border: 1px solid rgba(224, 86, 253, 0.3);
    color: var(--neon-purple);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-btn:hover {
    background: rgba(224, 86, 253, 0.25);
    color: var(--text-white);
    border-color: var(--neon-purple);
    box-shadow: 0 0 8px rgba(224, 86, 253, 0.3);
}

.refresh-btn:active {
    transform: scale(0.92);
}

.refresh-btn.spinning svg {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loader dots */
.loader-dots span {
    animation: blink 1.4s infinite both;
    font-weight: 900;
}
.loader-dots span:nth-child(2) { animation-delay: .2s; }
.loader-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes blink {
    0% { opacity: .2; }
    20% { opacity: 1; }
    100% { opacity: .2; }
}

/* ==========================================================================
   CARDS & WRAPPERS
   ========================================================================== */
.calc-card {
    background: rgba(43, 19, 78, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(224, 86, 253, 0.15);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: visible;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(224, 86, 253, 0.1);
    background: rgba(29, 11, 48, 0.3);
    border-top-left-radius: 19px;
    border-top-right-radius: 19px;
}

.card-title-icon {
    display: flex;
    align-items: center;
    filter: drop-shadow(0 0 4px var(--neon-cyan));
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-white);
    flex: 1;
}

/* Botón Limpiar todo en la cabecera del cálculo rápido */
.btn-clear-all {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 94, 245, 0.08);
    border: 1px solid rgba(255, 94, 245, 0.2);
    color: var(--neon-pink);
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.btn-clear-all:hover {
    background: rgba(255, 94, 245, 0.18);
    border-color: rgba(255, 94, 245, 0.45);
    box-shadow: 0 0 12px rgba(255, 94, 245, 0.15);
    transform: translateY(-1px);
}

.btn-clear-all:active {
    transform: translateY(0) scale(0.97);
}

.card-body {
    padding: 20px;
}

/* Form Groups & Inputs */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--neon-purple);
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0.45;
}

.select-wrapper:hover::after {
    opacity: 0.8;
}

.select-wrapper.active::after {
    transform: translateY(-50%) rotate(180deg);
    opacity: 0.9;
}

.main-select-wrapper::after {
    border-top-color: var(--neon-cyan) !important;
}

.main-select-wrapper:hover::after {
    opacity: 0.8;
}

.select-wrapper.active.main-select-wrapper::after {
    border-top-color: var(--neon-pink) !important;
    opacity: 0.9;
}

.custom-select {
    width: 100%;
    background: rgba(29, 11, 48, 0.7);
    color: var(--text-white);
    border: 1px solid rgba(224, 86, 253, 0.25);
    padding: 12px 40px;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 12px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-align-last: center;
}

.custom-select:focus {
    border-color: var(--neon-purple);
    box-shadow: 0 0 10px rgba(224, 86, 253, 0.25);
    background: rgba(29, 11, 48, 0.95);
}

.custom-select.main-resource-select {
    background: #190a35;
    border: 1px solid rgba(0, 255, 255, 0.5);
    color: var(--neon-cyan);
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 2px 10px rgba(0, 255, 255, 0.1), inset 0 0 6px rgba(0, 255, 255, 0.04);
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
}

.custom-select.main-resource-select:focus {
    border-color: rgba(255, 94, 245, 0.7);
    box-shadow: 0 2px 12px rgba(255, 94, 245, 0.15), inset 0 0 6px rgba(255, 94, 245, 0.04);
    color: var(--neon-pink);
    text-shadow: 0 0 5px rgba(255, 94, 245, 0.3);
}

/* Nivel de Fábrica Row Control */
.level-control-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.level-select-wrapper {
    flex: 1;
}

.machine-badge {
    background: linear-gradient(135deg, rgba(224, 86, 253, 0.2) 0%, rgba(0, 255, 255, 0.1) 100%);
    border: 1px solid rgba(224, 86, 253, 0.3);
    color: var(--text-white);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    text-align: center;
    font-family: var(--font-heading);
    box-shadow: inset 0 0 8px rgba(224, 86, 253, 0.1);
}

/* ==========================================================================
   DETALLES DE LA MÁQUINA (WORKSPACE ACTIVO)
   ========================================================================== */
.machine-meta-bar {
    display: flex;
    justify-content: space-between;
    background: rgba(18, 7, 43, 0.4);
    border: 1px dashed rgba(224, 86, 253, 0.2);
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 20px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
}

.meta-label {
    color: var(--text-muted);
}

.meta-val {
    font-weight: 700;
}

.highlight-cyan {
    color: var(--neon-cyan);
}

.highlight-purple {
    color: var(--neon-pink);
}

/* Grilla de Costos/Ingresos */
.price-editor-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (min-width: 500px) {
    .price-editor-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.grid-panel {
    background: rgba(18, 7, 43, 0.35);
    border: 1px solid rgba(224, 86, 253, 0.1);
    border-radius: 14px;
    padding: 14px;
}

.panel-subtitle {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(224, 86, 253, 0.08);
    padding-bottom: 6px;
}

.materials-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Barras de Total Costo / Total Ingreso */
.totals-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

@media (max-width: 600px) {
    .totals-row {
        grid-template-columns: 1fr;
    }
}

.total-summary-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid;
}

.total-cost-bar {
    background: linear-gradient(135deg, rgba(255, 94, 245, 0.06) 0%, rgba(224, 86, 253, 0.04) 100%);
    border-color: rgba(255, 94, 245, 0.2);
}

.total-revenue-bar {
    background: linear-gradient(135deg, rgba(0, 219, 100, 0.06) 0%, rgba(0, 255, 255, 0.04) 100%);
    border-color: rgba(0, 219, 100, 0.2);
}

.total-summary-label {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.total-cost-bar .total-summary-value {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 900;
    color: var(--neon-pink);
    text-shadow: 0 0 8px rgba(255, 94, 245, 0.2);
}

.total-revenue-bar .total-summary-value {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 900;
    color: var(--profit-green);
    text-shadow: 0 0 8px rgba(0, 219, 100, 0.2);
}

/* Fila de Material en la Lista */
.material-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.material-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.material-badge {
    display: flex;
    align-items: center;
    gap: 6px;
}

.material-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-white);
}

.material-qty {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.default-price-tag {
    font-size: 0.65rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease;
}

.default-price-tag:hover {
    color: var(--neon-cyan);
}

/* Controles numéricos */
.input-number-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.price-input {
    width: 100%;
    background: rgba(29, 11, 48, 0.6);
    border: 1px solid rgba(224, 86, 253, 0.2);
    color: var(--neon-gold);
    padding: 10px 60px 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    outline: none;
    transition: all 0.2s ease;
}

/* Chrome, Safari, Edge, Opera: Quitar flechas incrementales en inputs de tipo number */
.price-input::-webkit-outer-spin-button,
.price-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox: Quitar flechas incrementales en inputs de tipo number */
.price-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.price-input:focus {
    border-color: var(--neon-pink);
    box-shadow: 0 0 8px rgba(255, 94, 245, 0.2);
    background: rgba(29, 11, 48, 0.85);
}

.coin-suffix {
    position: absolute;
    right: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--neon-gold);
    pointer-events: none;
    text-transform: uppercase;
}

.sub-price-usd {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 2px;
    padding-right: 4px;
}

/* Panel de Salida (Específico) */
.output-panel {
    border-color: rgba(0, 255, 255, 0.1);
}

.output-panel .price-input {
    color: var(--neon-cyan);
    border-color: rgba(0, 255, 255, 0.2);
}

.output-panel .price-input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
}

.output-panel .coin-suffix {
    color: var(--neon-cyan);
}

/* Botones de acción */
.action-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
}

.btn-outline-purple {
    background: rgba(224, 86, 253, 0.05);
    border: 1px solid rgba(224, 86, 253, 0.25);
    color: var(--neon-pink);
}

.btn-outline-purple:hover {
    background: rgba(224, 86, 253, 0.15);
    border-color: var(--neon-pink);
    box-shadow: 0 0 8px rgba(255, 94, 245, 0.15);
}

/* ==========================================================================
   RESUMEN DE RENTABILIDAD (RESULTS CARD)
   ========================================================================== */
.results-card {
    background: rgba(43, 19, 78, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(224, 86, 253, 0.15);
    border-radius: 20px;
    padding: 16px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Dynamic State Classes */
.results-card.positive {
    border-color: var(--profit-green);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 219, 100, 0.15);
}

.results-card.negative {
    border-color: var(--loss-red);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 56, 56, 0.15);
}

.results-header {
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.results-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.results-indicator {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
}

.positive .results-indicator {
    background: rgba(0, 219, 100, 0.15);
    color: var(--profit-green);
}

.negative .results-indicator {
    background: rgba(255, 56, 56, 0.15);
    color: var(--loss-red);
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    text-align: center;
}

.result-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.result-value {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--text-white);
    line-height: 1.2;
}

.positive #net-profit-coins,
.positive #hourly-profit-coins,
.positive #roi-value {
    color: var(--profit-green);
    text-shadow: 0 0 8px rgba(0, 219, 100, 0.2);
}

.negative #net-profit-coins,
.negative #hourly-profit-coins,
.negative #roi-value {
    color: var(--loss-red);
    text-shadow: 0 0 8px rgba(255, 56, 56, 0.2);
}

.result-subvalue {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ==========================================================================
   FOOTER (TAB BAR)
   ========================================================================== */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--footer-height);
    background: rgba(18, 7, 43, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(224, 86, 253, 0.2);
    z-index: 100;
}

.tab-bar {
    max-width: 700px;
    height: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 0 8px;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    gap: 4px;
    transition: all 0.2s ease;
    border-top: 3px solid transparent;
}

.tab-item:hover:not(.disabled) {
    color: var(--text-white);
}

.tab-item.active {
    color: var(--neon-cyan);
    border-top-color: var(--neon-cyan);
    background: linear-gradient(180deg, rgba(0, 255, 255, 0.05) 0%, transparent 100%);
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

.tab-item.disabled {
    opacity: 0.4;
    cursor: default;
}

.tab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 480px) {
    .tab-label {
        font-size: 0.55rem;
        letter-spacing: 0px;
    }
}

/* Instalación y estado de la Progressive Web App */
.app-version-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
}

.app-version-card > div {
    display: grid;
    gap: 4px;
}

.app-version-description {
    color: var(--text-muted);
    font-size: 0.74rem;
}

.app-version-number {
    flex: 0 0 auto;
    border: 1px solid rgba(0, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(0, 255, 255, 0.07);
    color: var(--neon-cyan);
    padding: 6px 10px;
    font-family: var(--font-heading);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
}

body.light-theme .app-version-card {
    border-color: rgba(28, 24, 38, 0.1);
    background: rgba(28, 24, 38, 0.025);
}

.pwa-settings-card {
    display: grid;
    gap: 12px;
    margin-top: 20px;
    padding: 16px;
    border: 1px solid rgba(0, 255, 255, 0.18);
    border-radius: 14px;
    background: rgba(0, 255, 255, 0.035);
}

.pwa-settings-heading,
.pwa-settings-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pwa-settings-heading > div {
    display: grid;
    gap: 4px;
}

.pwa-app-icon {
    display: grid;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 12px;
    background: #0b051b;
    box-shadow: inset 0 0 0 1px rgba(0, 255, 255, 0.2);
}

.pwa-app-icon img {
    width: 34px;
    height: 34px;
}

.pwa-network-state {
    width: max-content;
    color: #6ee7b7;
    font-size: 0.76rem;
    font-weight: 700;
}

.pwa-network-state[data-state="offline"] {
    color: #fbbf24;
}

.pwa-status {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.45;
}

.pwa-settings-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.pwa-settings-actions button {
    min-height: 44px;
}

body.light-theme .pwa-settings-card {
    border-color: rgba(8, 145, 178, 0.22);
    background: rgba(8, 145, 178, 0.05);
}

@media (max-width: 480px) {
    .pwa-settings-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .pwa-settings-actions button {
        width: 100%;
    }
}

/* ==========================================================================
   ANIMACIONES Y AUXILIARES
   ========================================================================== */
.hidden {
    display: none !important;
}

.animate-fade-in {
    animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   PESTAÑA DE FÁBRICAS (LISTADO Y DETALLES)
   ========================================================================== */
.factories-controls {
    margin-bottom: 20px;
    width: 100%;
}

.factory-search-input {
    width: 100%;
    background: rgba(30, 9, 60, 0.6);
    border: 1px solid rgba(224, 86, 253, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-white);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    transition: all 0.25s ease;
}

.factory-search-input:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.25);
    background: rgba(30, 9, 60, 0.85);
}

.factories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.factory-card {
    background: rgba(43, 19, 78, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(224, 86, 253, 0.15);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.factory-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

#factories-grid .factory-card::before {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.1) 0%, transparent 100%);
}

#mastery-grid .factory-card::before {
    background: linear-gradient(135deg, rgba(224, 86, 253, 0.1) 0%, transparent 100%);
}

.factory-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    opacity: 0;
    transition: opacity 0.25s ease;
    border-radius: 0 0 16px 16px;
    pointer-events: none;
}

#factories-grid .factory-card::after {
    background: linear-gradient(90deg, var(--neon-cyan) 0%, var(--neon-purple) 100%);
}

#mastery-grid .factory-card::after {
    background: linear-gradient(90deg, var(--neon-purple) 0%, var(--neon-pink) 100%);
}

.factory-card:hover {
    transform: translateY(-4px);
    background: rgba(43, 19, 78, 0.55);
}

#factories-grid .factory-card:hover {
    border-color: rgba(0, 255, 255, 0.45);
    box-shadow: 0 8px 24px rgba(0, 255, 255, 0.15), 0 4px 12px rgba(0, 0, 0, 0.25);
}

#mastery-grid .factory-card:hover {
    border-color: rgba(224, 86, 253, 0.45);
    box-shadow: 0 8px 24px rgba(224, 86, 253, 0.15), 0 4px 12px rgba(0, 0, 0, 0.25);
}

.factory-card:hover::before,
.factory-card:hover::after {
    opacity: 1;
}

.factory-card-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transition: transform 0.25s ease;
    z-index: 1;
}

.factory-card:hover .factory-card-img {
    transform: scale(1.1);
}

.factory-card-name {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    z-index: 1;
}

.factory-card-levels {
    font-size: 0.7rem;
    color: var(--text-muted);
    z-index: 1;
}

/* Panel de detalles de fábrica */
.factory-detail-card {
    background: rgba(30, 9, 60, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(224, 86, 253, 0.25);
    border-radius: 20px;
    padding: 24px;
    margin-top: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.detail-header-row {
    margin-bottom: 20px;
}

.back-to-grid-btn {
    font-size: 0.8rem;
    padding: 8px 16px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.factory-detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(224, 86, 253, 0.15);
    padding-bottom: 20px;
}

.factory-detail-header-img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
}

.factory-detail-info {
    flex: 1;
}

.factory-detail-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    margin-bottom: 6px;
}

.workshop-summary-info {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.workshop-badge {
    background: rgba(224, 86, 253, 0.12);
    border: 1px solid rgba(224, 86, 253, 0.3);
    color: var(--text-white);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 500;
}

.workshop-badge.highlight {
    background: rgba(0, 255, 255, 0.08);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.detail-section-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--neon-pink);
    margin-bottom: 16px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Listado de Niveles en Detalle */
.detail-levels-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.detail-level-row {
    background: rgba(43, 19, 78, 0.35);
    border: 1px solid rgba(224, 86, 253, 0.15);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.detail-level-row:hover {
    border-color: rgba(224, 86, 253, 0.4);
    background: rgba(43, 19, 78, 0.5);
}

.level-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(224, 86, 253, 0.1);
    padding-bottom: 8px;
}

.level-row-badge {
    background: var(--bg-light-purple);
    color: var(--neon-cyan);
    border: 1px solid var(--neon-cyan);
    padding: 2px 8px;
    border-radius: 6px;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
}

.level-row-duration {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.level-row-middle {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.level-row-io {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.io-box {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(18, 7, 43, 0.4);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
}

.io-box.inputs {
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.io-box.output {
    border: 1px solid rgba(0, 255, 255, 0.25);
    color: var(--neon-cyan);
}

.io-arrow {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.level-row-profit {
    text-align: right;
    min-width: 120px;
}

.level-profit-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 900;
}

.level-profit-badge.positive {
    background: rgba(0, 219, 100, 0.12);
    color: var(--profit-green);
    border: 1px solid var(--profit-green);
}

.level-profit-badge.negative {
    background: rgba(255, 56, 56, 0.12);
    color: var(--loss-red);
    border: 1px solid var(--loss-red);
}

.level-profit-badge.neutral {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--text-muted);
}

/* Estilos para la Tabla de Niveles */
.detail-table-container {
    width: 100%;
    overflow-x: auto;
    background: rgba(30, 15, 58, 0.4);
    border: 1px solid rgba(224, 86, 253, 0.15);
    border-radius: 12px;
    margin-top: 16px;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

.detail-table th {
    background: rgba(18, 7, 43, 0.8);
    color: var(--neon-cyan);
    font-family: var(--font-heading);
    font-weight: 700;
    padding: 12px 16px;
    border-bottom: 2px solid rgba(224, 86, 253, 0.25);
    white-space: nowrap;
}

.detail-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(224, 86, 253, 0.1);
    color: var(--text-white);
    vertical-align: middle;
}

.detail-table tr:last-child td {
    border-bottom: none;
}

.detail-table tr:hover td {
    background: rgba(224, 86, 253, 0.05);
}

.table-level-badge {
    background: rgba(0, 255, 255, 0.1);
    color: var(--neon-cyan);
    border: 1px solid rgba(0, 255, 255, 0.3);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
    white-space: nowrap;
}

.table-upgrade-cost {
    color: var(--neon-gold);
    font-weight: 600;
}

.table-duration {
    color: var(--neon-pink);
    font-weight: 600;
    white-space: nowrap;
}

.table-mini-icon {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 4px;
    object-fit: contain;
}

.table-io-item {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-section-title {
    text-align: center;
    margin-top: 24px;
    margin-bottom: 12px;
}

/* ==========================================================================
   PESTAÑA DE WORKSHOPS (PORTADA)
   ========================================================================== */

/* Hero Banner */
.ws-hero-banner {
    background: linear-gradient(135deg, rgba(255, 190, 26, 0.12) 0%, rgba(224, 86, 253, 0.08) 50%, rgba(0, 255, 255, 0.06) 100%);
    border: 1px solid rgba(255, 190, 26, 0.25);
    border-radius: 20px;
    padding: 20px 24px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.ws-hero-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(255, 190, 26, 0.1) 0%, transparent 70%);
    pointer-events: none;
    animation: wsPulseGlow 4s ease-in-out infinite;
}

@keyframes wsPulseGlow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

.ws-hero-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, rgba(255, 190, 26, 0.2) 0%, rgba(255, 94, 245, 0.12) 100%);
    border: 1.5px solid rgba(255, 190, 26, 0.4);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--neon-gold);
    box-shadow: 0 0 16px rgba(255, 190, 26, 0.2);
    flex-shrink: 0;
}

.ws-hero-text {
    flex: 1;
    min-width: 150px;
}

.ws-hero-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(90deg, var(--neon-gold) 0%, #ffe259 50%, var(--neon-pink) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 2px;
}

.ws-hero-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.4;
}

.ws-hero-stats {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.ws-stat-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(18, 7, 43, 0.5);
    border: 1px solid rgba(255, 190, 26, 0.2);
    border-radius: 10px;
    padding: 8px 14px;
    min-width: 72px;
}

.ws-stat-value {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--neon-gold);
    text-shadow: 0 0 6px rgba(255, 190, 26, 0.25);
}

.ws-stat-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Workshop Search */
.ws-controls {
    margin-bottom: 20px;
    width: 100%;
}

.ws-search-input {
    width: 100%;
    background: rgba(30, 9, 60, 0.6);
    border: 1px solid rgba(255, 190, 26, 0.25);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-white);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    transition: all 0.25s ease;
}

.ws-search-input:focus {
    outline: none;
    border-color: var(--neon-gold);
    box-shadow: 0 0 10px rgba(255, 190, 26, 0.2);
    background: rgba(30, 9, 60, 0.85);
}

/* Workshop Grid: 2 columns, horizontal card design */
.ws-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

@media (min-width: 500px) {
    .ws-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Workshop Card — horizontal layout */
.ws-card {
    background: rgba(43, 19, 78, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 190, 26, 0.12);
    border-radius: 14px;
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.ws-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--neon-gold) 0%, var(--neon-pink) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
    border-radius: 4px 0 0 4px;
}

.ws-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 190, 26, 0.35);
    box-shadow: 0 8px 28px rgba(255, 190, 26, 0.1), 0 4px 12px rgba(0, 0, 0, 0.2);
    background: rgba(43, 19, 78, 0.5);
}

.ws-card:hover::after {
    opacity: 1;
}

.ws-card:active {
    transform: translateY(0) scale(0.98);
}

/* Machine image (factory building image) */
.ws-card-img-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 190, 26, 0.08) 0%, rgba(224, 86, 253, 0.06) 100%);
    border: 1px solid rgba(255, 190, 26, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.ws-card-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
    transition: transform 0.3s ease;
}

.ws-card:hover .ws-card-img {
    transform: scale(1.12) rotate(-3deg);
}

/* Card text info */
.ws-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ws-card-name {
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ws-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ws-card-levels-badge {
    background: rgba(255, 190, 26, 0.1);
    border: 1px solid rgba(255, 190, 26, 0.25);
    color: var(--neon-gold);
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.65rem;
    font-weight: 700;
    white-space: nowrap;
}

.ws-card-bonus-badge {
    background: rgba(0, 219, 100, 0.08);
    border: 1px solid rgba(0, 219, 100, 0.25);
    color: var(--profit-green);
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.65rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Speed bonus bar */
.ws-card-bar-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 2px;
}

.ws-card-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--neon-gold) 0%, var(--profit-green) 100%);
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 6px rgba(255, 190, 26, 0.3);
}

/* Arrow indicator on the right */
.ws-card-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.2s ease, color 0.2s ease;
    opacity: 0.5;
}

.ws-card:hover .ws-card-arrow {
    color: var(--neon-gold);
    transform: translateX(3px);
    opacity: 1;
}

/* Responsive adjustments for hero stats */

/* ==========================================================================
   PESTAÑA DE WORKSHOPS (DETALLE DE MEJORAS)
   ========================================================================== */

.ws-detail-card {
    background: rgba(30, 9, 60, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 190, 26, 0.25);
    border-radius: 20px;
    padding: 24px;
    margin-top: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.btn-outline-gold {
    background: rgba(255, 190, 26, 0.05);
    border: 1px solid rgba(255, 190, 26, 0.25);
    color: var(--neon-gold);
}

.btn-outline-gold:hover {
    background: rgba(255, 190, 26, 0.15);
    border-color: var(--neon-gold);
    box-shadow: 0 0 8px rgba(255, 190, 26, 0.15);
}

.ws-detail-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 20px;
}

@media (min-width: 600px) {
    .ws-detail-container {
        grid-template-columns: 200px 1fr;
    }
}

.ws-detail-left-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ws-detail-right-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ws-detail-img-box {
    background: rgba(18, 7, 43, 0.4);
    border: 1px solid rgba(255, 190, 26, 0.15);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: inset 0 0 12px rgba(255, 190, 26, 0.05);
}

.ws-detail-large-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.5));
}

.ws-detail-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(43, 19, 78, 0.35);
    border: 1px solid rgba(255, 190, 26, 0.12);
    padding: 12px 16px;
    border-radius: 12px;
}

.ws-detail-info-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ws-detail-info-val {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--neon-gold);
    text-shadow: 0 0 6px rgba(255, 190, 26, 0.3);
}

.ws-detail-table-card {
    background: rgba(43, 19, 78, 0.35);
    border: 1px solid rgba(255, 190, 26, 0.15);
    border-radius: 16px;
    overflow: hidden;
}

.ws-detail-table-title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-white);
    padding: 16px;
    background: rgba(18, 7, 43, 0.4);
    border-bottom: 1px solid rgba(255, 190, 26, 0.15);
    margin: 0;
    letter-spacing: 0.5px;
}

.ws-detail-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.ws-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    text-align: left;
}

.ws-detail-table th {
    background: rgba(18, 7, 43, 0.2);
    color: var(--neon-gold);
    font-family: var(--font-heading);
    font-weight: 700;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 190, 26, 0.15);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.72rem;
}

.ws-detail-table td {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 190, 26, 0.08);
    color: var(--text-white);
    vertical-align: middle;
}

.ws-detail-table tr:last-child td {
    border-bottom: none;
}

.ws-detail-table tr:hover td {
    background: rgba(255, 190, 26, 0.04);
}

.ws-level-badge {
    background: rgba(255, 190, 26, 0.08);
    color: var(--neon-gold);
    border: 1px solid rgba(255, 190, 26, 0.2);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.75rem;
    display: inline-block;
    white-space: nowrap;
}

.ws-pts-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--text-white);
}

.ws-bonus-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--profit-green);
    font-weight: 700;
    text-shadow: 0 0 6px rgba(0, 219, 100, 0.2);
}

.ws-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 190, 26, 0.15);
}

.ws-header-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--neon-gold);
    text-shadow: 0 0 8px rgba(255, 190, 26, 0.25);
    margin: 0;
}

.ws-header-res-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* ==========================================================================
   PESTAÑA DE FÁBRICAS (HERO BANNER)
   ========================================================================== */

.fact-hero-banner {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.1) 0%, rgba(224, 86, 253, 0.08) 50%, rgba(43, 19, 78, 0.3) 100%);
    border: 1px solid rgba(0, 255, 255, 0.25);
    border-radius: 20px;
    padding: 20px 24px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.fact-hero-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(0, 255, 255, 0.08) 0%, transparent 70%);
    pointer-events: none;
    animation: factPulseGlow 4s ease-in-out infinite;
}

@keyframes factPulseGlow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

.fact-hero-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.18) 0%, rgba(255, 94, 245, 0.12) 100%);
    border: 1.5px solid rgba(0, 255, 255, 0.35);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--neon-cyan);
    box-shadow: 0 0 16px rgba(0, 255, 255, 0.15);
    flex-shrink: 0;
}

.fact-hero-text {
    flex: 1;
    min-width: 150px;
}

.fact-hero-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(90deg, #ffffff 0%, var(--neon-cyan) 60%, var(--neon-purple) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 2px;
}

.fact-hero-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 400;
    line-height: 1.4;
}

.fact-hero-stats {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.fact-stat-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(18, 7, 43, 0.5);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 10px;
    padding: 8px 14px;
    min-width: 72px;
}

.fact-stat-value {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--neon-cyan);
    text-shadow: 0 0 6px rgba(0, 255, 255, 0.25);
}

.fact-stat-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

@media (max-width: 499px) {
    .fact-hero-stats {
        width: 100%;
        justify-content: center;
    }

    .fact-hero-banner {
        text-align: center;
        justify-content: center;
    }

    .fact-hero-text {
        text-align: center;
    }
}

/* Selectores en fila del calculador rápido */
#level-group {
    position: relative;
    z-index: 10;
}

.select-wrapper.active {
    z-index: 50;
}

.ws-selectors-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    width: 100%;
}

@media (min-width: 550px) {
    .ws-selectors-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

.ws-selector-col {
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   CUSTOM DROPDOWN SELECT STYLING
   ========================================================================== */

.custom-select-trigger {
    width: 100%;
    background: rgba(29, 11, 48, 0.7);
    color: var(--text-white);
    border: 1px solid rgba(224, 86, 253, 0.25);
    padding: 12px 40px;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 12px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    user-select: none;
    box-sizing: border-box;
    font-family: inherit;
}

/* Modificaciones específicas para inputs cuando actúan de trigger de búsqueda */
input.custom-select-trigger {
    cursor: pointer;
}

input.custom-select-trigger:not([readonly]) {
    cursor: text;
    user-select: text;
    caret-color: var(--neon-cyan);
}

.select-wrapper:hover .custom-select-trigger {
    border-color: rgba(224, 86, 253, 0.45);
}

.select-wrapper.active .custom-select-trigger {
    border-color: var(--neon-purple);
    box-shadow: 0 0 10px rgba(224, 86, 253, 0.25);
    background: rgba(29, 11, 48, 0.95);
}

.select-wrapper.active .custom-select-trigger:not([readonly]) {
    caret-color: var(--neon-pink);
}

/* Selector de recursos principal */
.custom-select-trigger.main-resource-select {
    background: #190a35;
    border: 1px solid rgba(0, 255, 255, 0.5);
    color: var(--neon-cyan);
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 2px 10px rgba(0, 255, 255, 0.1), inset 0 0 6px rgba(0, 255, 255, 0.04);
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
}

/* Placeholders para el buscador principal */
.custom-select-trigger.main-resource-select::placeholder {
    color: rgba(0, 255, 255, 0.4);
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.2);
    opacity: 1;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

.select-wrapper.active .custom-select-trigger.main-resource-select {
    border-color: rgba(255, 94, 245, 0.7);
    box-shadow: 0 2px 12px rgba(255, 94, 245, 0.15), inset 0 0 6px rgba(255, 94, 245, 0.04);
    color: var(--neon-pink);
    text-shadow: 0 0 5px rgba(255, 94, 245, 0.3);
}

.select-wrapper.active .custom-select-trigger.main-resource-select::placeholder {
    color: rgba(255, 94, 245, 0.4);
    text-shadow: 0 0 5px rgba(255, 94, 245, 0.2);
    opacity: 1;
}

/* Lista desplegable personalizada */
.custom-select-options-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: rgba(25, 10, 53, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(224, 86, 253, 0.25);
    border-radius: 12px;
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 15px rgba(224, 86, 253, 0.05);
    padding: 6px;
    animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Opciones individuales */
.custom-select-option {
    padding: 10px 16px;
    text-align: center;
    color: var(--text-white);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 2px;
}

.custom-select-option:last-child {
    margin-bottom: 0;
}

.custom-select-option:hover {
    background: rgba(224, 86, 253, 0.15);
    color: var(--neon-cyan);
}

.custom-select-option.selected {
    background: rgba(224, 86, 253, 0.3);
    color: var(--neon-cyan);
    font-weight: 700;
    border: 1px solid rgba(0, 255, 255, 0.2);
}

/* Scrollbar para la lista desplegable personalizada */
.custom-select-options-list::-webkit-scrollbar {
    width: 6px;
}
.custom-select-options-list::-webkit-scrollbar-track {
    background: transparent;
}
.custom-select-options-list::-webkit-scrollbar-thumb {
    background: rgba(224, 86, 253, 0.3);
    border-radius: 3px;
}
.custom-select-options-list::-webkit-scrollbar-thumb:hover {
    background: var(--neon-purple);
}

/* Botón de engranaje (ajustes) en el header */
.settings-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    margin-left: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    border-radius: 4px;
    outline: none;
}

.settings-btn:hover {
    color: var(--neon-cyan);
    transform: rotate(45deg);
    filter: drop-shadow(0 0 6px rgba(0, 255, 255, 0.4));
}

body.light-theme .settings-btn:hover {
    color: #9b28b6;
    filter: drop-shadow(0 0 6px rgba(155, 40, 182, 0.25));
}

/* Modal de Ajustes */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.settings-modal.hidden {
    display: none !important;
}

.settings-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(6, 2, 14, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.settings-modal-content {
    position: relative;
    width: 90%;
    max-width: 320px;
    background: rgba(30, 9, 60, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(224, 86, 253, 0.3);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 20px rgba(224, 86, 253, 0.15);
    z-index: 1001;
    overflow: hidden;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(224, 86, 253, 0.15);
}

.settings-modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--neon-cyan);
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.25);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0;
}

.settings-modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.settings-modal-close:hover {
    color: var(--neon-pink);
    transform: scale(1.1);
}

.settings-modal-body {
    padding: 20px;
}

/* Ajustes: panel compacto en escritorio y una sola columna en móvil. */
#settings-modal .settings-modal-content {
    width: min(92vw, 780px);
    max-width: 780px;
    max-height: min(88dvh, 720px);
}

#settings-modal .settings-dashboard {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    overflow-y: auto;
}

#settings-modal .settings-option,
#settings-modal .app-version-card,
#settings-modal .pwa-settings-card,
#settings-modal .admin-access-card {
    min-width: 0;
    margin-top: 0;
}

#settings-modal .settings-option {
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
}

#settings-modal .settings-option .theme-switch-container {
    width: 100%;
    margin-top: 2px;
    padding-inline: 12px;
}

#settings-modal .app-version-card {
    grid-column: 1 / -1;
}

#settings-modal .pwa-settings-card,
#settings-modal .admin-access-card {
    align-content: start;
}

#settings-modal .admin-access-card {
    display: grid;
    gap: 12px;
}

#settings-modal .admin-access-card .admin-auth-description {
    margin: 0;
}

#settings-modal .admin-session-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
}

#settings-modal .admin-session-panel.hidden {
    display: none;
}

.settings-option {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Estilos para el Modal de Editar Listado de Contribuciones */
.mp-edit-slots-counter-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(18, 7, 43, 0.6);
    border: 1px solid rgba(255, 190, 26, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.mp-edit-slots-title {
    font-weight: 700;
    color: var(--text-white);
    font-size: 0.9rem;
}

.mp-edit-slots-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.mp-edit-slots-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mp-counter-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(224, 86, 253, 0.3);
    background: rgba(224, 86, 253, 0.12);
    color: #ffffff;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mp-counter-btn:hover {
    background: rgba(224, 86, 253, 0.3);
    border-color: var(--neon-purple);
    transform: scale(1.05);
}

.mp-counter-num {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--neon-gold);
    min-width: 28px;
    text-align: center;
    font-family: var(--font-heading);
}

.mp-edit-actions-row {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.mp-btn-save-list {
    width: 100%;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 800;
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--neon-purple) 0%, var(--neon-pink) 100%);
    border: 1px solid rgba(224, 86, 253, 0.4);
    color: #ffffff !important;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 16px rgba(224, 86, 253, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
}

.mp-btn-save-list:hover {
    background: linear-gradient(135deg, #e056fd 0%, #ff5ef5 100%);
    box-shadow: 0 0 20px rgba(224, 86, 253, 0.5);
    transform: translateY(-1px);
}

.mp-btn-save-list:active {
    transform: translateY(0) scale(0.98);
}

body.light-theme .mp-btn-save-list {
    background: linear-gradient(135deg, #8e1fa7 0%, #cc25c4 100%) !important;
    color: #ffffff !important;
}

body.normal-style .mp-btn-save-list {
    background: var(--bg-light-purple) !important;
    border-color: var(--bg-light-purple) !important;
    color: var(--text-white) !important;
    box-shadow: none !important;
}

.mp-combo-center-wrapper {
    grid-column: 1 / -1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 24px 10px !important;
    box-sizing: border-box !important;
}

/* Estilos para el Panel de Mezcla de Recursos (Multi-Recursos) */
.mp-combo-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.mp-combo-badge-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(224, 86, 253, 0.12);
    border: 1px solid rgba(224, 86, 253, 0.35);
    border-radius: 12px;
    padding: 10px 16px;
}

.mp-combo-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--neon-cyan);
    display: flex;
    align-items: center;
    gap: 8px;
}

.mp-combo-count-badge {
    background: rgba(0, 255, 255, 0.15);
    border: 1px solid rgba(0, 255, 255, 0.4);
    color: var(--neon-cyan);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}

.mp-combo-table-container {
    background: rgba(18, 7, 43, 0.6);
    border: 1px solid rgba(255, 190, 26, 0.2);
    border-radius: 14px;
    overflow-x: auto;
    padding: 12px;
}

.mp-combo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
}

.mp-combo-table th {
    text-align: center;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 190, 26, 0.15);
}

.mp-combo-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-white);
    font-weight: 600;
}

.mp-combo-table tr:last-child td {
    border-bottom: none;
}

.mp-combo-item-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
}

.mp-combo-item-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.mp-combo-item-name {
    font-weight: 700;
    color: var(--text-white);
}

.mp-combo-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.mp-combo-summary-card {
    background: rgba(30, 15, 58, 0.6);
    border: 1px solid rgba(224, 86, 253, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mp-combo-summary-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mp-combo-summary-value {
    font-size: 1.15rem;
    font-weight: 800;
    font-family: var(--font-heading);
}

.mp-combo-summary-sub {
    font-size: 0.75rem;
    font-weight: 600;
}

/* ==========================================================================
   LIGHT THEME VARIABLES OVERRIDES
   ========================================================================== */
body.light-theme {
    --bg-dark-purple: #f3f0f7;
    --bg-medium-purple: #e9e3f3;
    --bg-light-purple: #dcd4eb;

    /* Colores Neón adaptados para legibilidad */
    --neon-cyan: #008f8f;
    --neon-pink: #cc25c4;
    --neon-purple: #8e1fa7;
    --neon-gold: #ab7900;

    --text-white: #1b0a3c;
    --text-muted: #5e4c7d;
    --text-dark: #f3f0f7;

    --profit-green: #008c3a;
    --loss-red: #cc2424;
}

/* Ajustes de Light Theme en elementos */
body.light-theme {
    background-image: radial-gradient(circle at 50% 50%, #f6f4fa 0%, #eae5f5 100%);
}

body.light-theme .calc-card,
body.light-theme .factory-card,
body.light-theme .ws-card,
body.light-theme .factory-detail-card,
body.light-theme .ws-detail-table-card,
body.light-theme .detail-table-container {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(142, 31, 167, 0.18);
    box-shadow: 0 8px 32px rgba(27, 10, 60, 0.04), 0 2px 8px rgba(0, 0, 0, 0.02);
}

body.light-theme .app-header {
    background: rgba(255, 255, 255, 0.85);
    border-bottom-color: rgba(142, 31, 167, 0.18);
}

body.light-theme .app-footer {
    background: rgba(255, 255, 255, 0.9);
    border-top-color: rgba(142, 31, 167, 0.18);
}

body.light-theme .custom-select-trigger {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(142, 31, 167, 0.25);
    color: #1b0a3c;
}

body.light-theme .custom-select-trigger.main-resource-select {
    background: #ffffff;
    border-color: #008f8f;
    color: #008f8f;
    text-shadow: none;
    box-shadow: 0 2px 10px rgba(0, 143, 143, 0.06);
}

body.light-theme .custom-select-options-list {
    background: #ffffff;
    border-color: rgba(142, 31, 167, 0.25);
    box-shadow: 0 10px 24px rgba(27, 10, 60, 0.08);
}

body.light-theme .custom-select-option {
    color: #1b0a3c;
}

body.light-theme .custom-select-option:hover {
    background: rgba(142, 31, 167, 0.08);
    color: #8e1fa7;
}

body.light-theme .custom-select-option.selected {
    background: rgba(142, 31, 167, 0.15);
    color: #8e1fa7;
    border-color: rgba(0, 143, 143, 0.2);
}

body.light-theme .price-input {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(142, 31, 167, 0.2);
    color: #1b0a3c;
}

body.light-theme .price-input:focus {
    background: #ffffff;
    border-color: #cc25c4;
    box-shadow: 0 0 8px rgba(204, 37, 196, 0.15);
}

body.light-theme .totals-box.cost {
    background: rgba(204, 37, 196, 0.06);
    border-color: rgba(204, 37, 196, 0.2);
}

body.light-theme .totals-box.revenue {
    background: rgba(0, 140, 58, 0.06);
    border-color: rgba(0, 140, 58, 0.2);
}

body.light-theme .card-header {
    border-bottom-color: rgba(142, 31, 167, 0.12);
}

body.light-theme .btn-clear-all {
    background: rgba(142, 31, 167, 0.06);
    border-color: rgba(142, 31, 167, 0.25);
    color: #8e1fa7;
}

body.light-theme .btn-clear-all:hover {
    background: rgba(142, 31, 167, 0.12);
    color: #8e1fa7;
    border-color: #8e1fa7;
    box-shadow: 0 0 8px rgba(142, 31, 167, 0.15);
}

body.light-theme .results-card {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(142, 31, 167, 0.15);
}

body.light-theme .results-card.positive {
    border-color: rgba(0, 140, 58, 0.4);
    box-shadow: 0 8px 32px rgba(0, 140, 58, 0.08);
}

body.light-theme .results-card.negative {
    border-color: rgba(204, 36, 36, 0.4);
    box-shadow: 0 8px 32px rgba(204, 36, 36, 0.08);
}

body.light-theme .result-glow-layer {
    opacity: 0.08;
}

body.light-theme .result-stat-val {
    color: #1b0a3c;
}

body.light-theme .result-label {
    color: #5e4c7d;
}

body.light-theme .tab-item {
    color: #5e4c7d;
}

body.light-theme .tab-item:hover:not(.disabled) {
    color: #1b0a3c;
}

body.light-theme .tab-item.active {
    color: #008f8f;
    border-top-color: #008f8f;
    background: linear-gradient(180deg, rgba(0, 143, 143, 0.05) 0%, transparent 100%);
    text-shadow: none;
}

body.light-theme .detail-table th {
    background: rgba(220, 212, 235, 0.5);
    color: #8e1fa7;
    border-bottom-color: rgba(142, 31, 167, 0.2);
}

body.light-theme .detail-table td {
    border-bottom-color: rgba(142, 31, 167, 0.08);
}

body.light-theme .detail-table tr:hover td {
    background: rgba(142, 31, 167, 0.04);
}

body.light-theme .ws-detail-info-row {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(142, 31, 167, 0.15);
}

body.light-theme .factory-search-input,
body.light-theme .ws-search-input {
    background: #ffffff;
    border-color: rgba(142, 31, 167, 0.25);
    color: #1b0a3c;
}

body.light-theme .factory-search-input:focus,
body.light-theme .ws-search-input:focus {
    border-color: #8e1fa7;
    box-shadow: 0 0 8px rgba(142, 31, 167, 0.15);
    background: #ffffff;
}

body.light-theme .ws-card-bar-track {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .settings-modal-content {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(142, 31, 167, 0.3);
    box-shadow: 0 20px 50px rgba(27, 10, 60, 0.12), 0 0 20px rgba(142, 31, 167, 0.05);
}

body.light-theme .settings-modal-header h3 {
    color: #8e1fa7;
    text-shadow: none;
}

body.light-theme .settings-modal-close {
    color: #5e4c7d;
}

body.light-theme .custom-select-trigger.main-resource-select::placeholder {
    color: rgba(0, 143, 143, 0.4);
    text-shadow: none;
}

body.light-theme .select-wrapper.active .custom-select-trigger.main-resource-select::placeholder {
    color: rgba(204, 37, 196, 0.4);
    text-shadow: none;
}

body.light-theme .no-inputs-msg {
    color: #5e4c7d !important;
}

/* Contenedor del interruptor de tema */
.theme-switch-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
    background: rgba(18, 7, 43, 0.4);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(224, 86, 253, 0.15);
}

body.light-theme .theme-switch-container {
    background: rgba(220, 212, 235, 0.4);
    border-color: rgba(142, 31, 167, 0.15);
}

.settings-option-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.theme-label-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.25s ease;
}

.theme-label-text.active-dark {
    color: var(--neon-cyan);
    font-weight: 700;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

.theme-label-text.active-light {
    color: var(--neon-pink);
    font-weight: 700;
    text-shadow: 0 0 8px rgba(255, 94, 245, 0.3);
}

body.light-theme .theme-label-text.active-light {
    color: #cc25c4;
    text-shadow: none;
}

/* Interruptor (switch checkbox) */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(44, 15, 86, 0.6);
    transition: .4s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 24px;
    border: 1px solid rgba(224, 86, 253, 0.3);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-white);
    transition: .4s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Cambios al activar (Modo Claro) */
.switch input:checked + .slider {
    background-color: rgba(0, 255, 255, 0.15);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.switch input:checked + .slider:before {
    transform: translateX(24px);
    background-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
}

/* Modificaciones de los estilos en Light Mode */
body.light-theme .slider {
    background-color: rgba(220, 212, 235, 0.6);
    border-color: rgba(142, 31, 167, 0.3);
}

body.light-theme .switch input:checked + .slider {
    background-color: rgba(142, 31, 167, 0.15);
    border-color: #8e1fa7;
    box-shadow: none;
}

body.light-theme .switch input:checked + .slider:before {
    background-color: #8e1fa7;
    box-shadow: none;
}

/* Selector con búsqueda más pequeño para la pestaña de Masterpiece */
.custom-select-trigger.mp-search-trigger {
    min-height: 34px !important;
    padding: 6px 12px 6px 30px !important; /* Más espacio a la izquierda para el cursor */
    font-size: 0.8rem !important;
    border-radius: 8px !important;
    letter-spacing: 0px !important;
    text-transform: none !important;
    background: rgba(18, 7, 43, 0.4) !important;
    border: 1px solid rgba(255, 190, 26, 0.25) !important;
    color: var(--text-white) !important;
    text-shadow: none !important;
    box-shadow: none !important;
    min-width: 140px;
}

body.light-theme .custom-select-trigger.mp-search-trigger {
    background: #ffffff !important;
    border-color: rgba(142, 31, 167, 0.25) !important;
    color: #1b0a3c !important;
}

.select-wrapper.active .custom-select-trigger.mp-search-trigger {
    border-color: var(--neon-cyan) !important;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.2) !important;
}

body.light-theme .select-wrapper.active .custom-select-trigger.mp-search-trigger {
    border-color: #8e1fa7 !important;
    box-shadow: none !important;
}

.custom-select-trigger.mp-search-trigger::placeholder {
    color: var(--text-muted) !important;
    font-size: 0.8rem !important;
    text-shadow: none !important;
}

body.light-theme .custom-select-trigger.mp-search-trigger::placeholder {
    color: rgba(94, 76, 125, 0.6) !important;
}

.select-wrapper.active .custom-select-trigger.mp-search-trigger::placeholder {
    color: rgba(0, 255, 255, 0.4) !important;
}

body.light-theme .select-wrapper.active .custom-select-trigger.mp-search-trigger::placeholder {
    color: rgba(142, 31, 167, 0.4) !important;
}

/* ==========================================================================
   ESTILOS DE TABLA DE MASTERPIECE
   ========================================================================== */
#mp-calculator-table {
    width: 100%;
    border-collapse: collapse;
}

#mp-calculator-table th {
    padding: 10px 6px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(255, 190, 26, 0.25);
    color: var(--neon-cyan);
    text-align: center !important;
    white-space: normal !important;
}

body.light-theme #mp-calculator-table th {
    color: #8e1fa7;
    border-bottom: 2px solid rgba(142, 31, 167, 0.25);
}

#mp-calculator-table td {
    padding: 8px 6px;
    vertical-align: middle;
    text-align: center !important;
}

#mp-calculator-table tr {
    transition: background-color 0.2s ease;
}

#mp-calculator-table tr:hover {
    background: rgba(255, 190, 26, 0.02);
}

body.light-theme #mp-calculator-table tr:hover {
    background: rgba(142, 31, 167, 0.02);
}

#mp-calculator-table .price-input {
    width: 100%;
    height: 32px;
    background: rgba(18, 7, 43, 0.5) !important;
    border: 1px solid rgba(255, 190, 26, 0.2) !important;
    border-radius: 6px !important;
    color: var(--text-white) !important;
    font-family: inherit;
    font-size: 0.8rem !important;
    text-align: center;
    padding: 0 8px !important;
    transition: all 0.3s ease;
    outline: none;
}

#mp-calculator-table .price-input:focus {
    border-color: var(--neon-cyan) !important;
    box-shadow: 0 0 6px rgba(0, 255, 255, 0.25) !important;
    background: rgba(18, 7, 43, 0.8) !important;
}

body.light-theme #mp-calculator-table .price-input {
    background: #ffffff !important;
    border-color: rgba(142, 31, 167, 0.2) !important;
    color: #1b0a3c !important;
}

body.light-theme #mp-calculator-table .price-input:focus {
    border-color: #8e1fa7 !important;
    box-shadow: 0 0 6px rgba(142, 31, 167, 0.15) !important;
}

#mp-calculator-table .price-input:disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    background: rgba(18, 7, 43, 0.25) !important;
}

body.light-theme #mp-calculator-table .price-input:disabled {
    background: #f4f1fa !important;
    border-color: rgba(142, 31, 167, 0.05) !important;
}

/* Ensanchar el contenedor de la app cuando la pestaña Masterpiece esté activa para mostrar la grilla completa */
.app-content:has(#masterpieces-tab-content:not(.hidden)) {
    max-width: 1000px !important;
    transition: max-width 0.3s ease-in-out;
}

/* Eliminar la flecha de desplegable del lado derecho en la pestaña Masterpiece (salvo en el recomendador) */
#mp-calculator-table .select-wrapper::after {
    display: none !important;
}

/* ==========================================================================
   MASTERPIECE GOAL RECOMMENDER CARD
   ========================================================================== */
.mp-goal-card {
    background: linear-gradient(135deg, rgba(255, 190, 26, 0.08) 0%, rgba(224, 86, 253, 0.05) 50%, rgba(43, 19, 78, 0.4) 100%);
    border: 1px solid rgba(255, 190, 26, 0.25);
    border-radius: 20px;
    padding: 20px 24px;
    margin-bottom: 20px;
    position: relative;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
}

.mp-goal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 16px;
    margin-bottom: 20px;
    width: 100%;
}

.mp-goal-title-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
}

.mp-goal-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    background: linear-gradient(90deg, #ffffff 0%, var(--neon-gold) 60%, var(--neon-pink) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    text-align: center !important;
    width: 100%;
}

.mp-goal-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: center !important;
    width: 100%;
}

.mp-goal-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    width: 100%;
}

.mp-control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.mp-control-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    width: 100%;
    display: block;
}

.mp-goal-number-input {
    width: 190px !important;
    height: 38px !important;
    background: rgba(18, 7, 43, 0.7) !important;
    border: 1px solid rgba(255, 190, 26, 0.3) !important;
    border-radius: 8px !important;
    color: var(--text-white) !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    padding: 0 12px !important;
    text-align: center !important;
}

.mp-control-group .select-wrapper {
    width: 200px !important;
    height: 38px !important;
    min-height: 38px !important;
}

.mp-control-group .select-wrapper .custom-select-trigger {
    min-height: 38px !important;
    height: 38px !important;
    padding: 0 24px 0 10px !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    border-radius: 8px !important;
    border-color: rgba(255, 190, 26, 0.3) !important;
    background: rgba(18, 7, 43, 0.7) !important;
}

.mp-control-group .select-wrapper::after {
    top: 50% !important;
    transform: translateY(-50%) !important;
    right: 10px !important;
}

.mp-control-group .custom-select-options-list .custom-select-option {
    white-space: nowrap !important;
    font-size: 0.82rem !important;
    padding: 8px 12px !important;
    text-align: center !important;
}

.mp-goal-number-input:focus {
    border-color: var(--neon-gold) !important;
    box-shadow: 0 0 10px rgba(255, 190, 26, 0.3) !important;
}

/* Winner Card Dropdown Styling */
.mp-winner-dropdown-wrapper {
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mp-winner-dropdown-wrapper:hover {
    border-color: rgba(255, 190, 26, 0.5) !important;
    box-shadow: 0 0 12px rgba(255, 190, 26, 0.2) !important;
}

.mp-winner-dropdown-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: rgba(24, 10, 50, 0.95);
    border: 1.5px solid rgba(255, 190, 26, 0.4);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.75);
    z-index: 100;
    overflow: hidden;
    padding: 6px;
    backdrop-filter: blur(10px);
}

.mp-winner-dropdown-list.hidden {
    display: none !important;
}

.mp-winner-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.mp-winner-dropdown-item:hover {
    background: rgba(255, 190, 26, 0.18);
}

.mp-winner-dropdown-item.selected {
    background: rgba(255, 190, 26, 0.28);
    border: 1px solid rgba(255, 190, 26, 0.4);
}

.mp-winner-item-rank {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 0.85rem;
    color: var(--neon-gold);
    width: 24px;
    text-align: center;
}

.mp-winner-item-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.mp-winner-item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.mp-winner-item-name {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1.2;
}

.mp-winner-item-sub {
    font-size: 0.65rem;
    color: var(--neon-gold);
    font-weight: 700;
}

.mp-winner-item-check {
    color: var(--neon-gold);
    font-weight: 900;
    font-size: 0.95rem;
    margin-left: 4px;
}

body.light-theme .mp-winner-dropdown-list {
    background: #ffffff !important;
    border-color: rgba(142, 31, 167, 0.35) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}

body.light-theme .mp-winner-dropdown-item:hover {
    background: rgba(142, 31, 167, 0.08) !important;
}

body.light-theme .mp-winner-dropdown-item.selected {
    background: rgba(142, 31, 167, 0.15) !important;
}

body.light-theme .mp-winner-item-name {
    color: #1b0a3c !important;
}

.mp-recommendation-panel {
    background: rgba(18, 7, 43, 0.5);
    border: 1px solid rgba(255, 190, 26, 0.18);
    border-radius: 14px;
    padding: 16px 20px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    align-items: center;
}

@media (max-width: 820px) {
    .mp-recommendation-panel {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .mp-recommendation-panel {
        grid-template-columns: 1fr;
    }
}

.mp-rec-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 76px;
    height: 76px;
    box-sizing: border-box;
}

.mp-rec-card.winner-card {
    background: rgba(255, 190, 26, 0.08);
    border-color: rgba(255, 190, 26, 0.25);
}

/* Modal Fullscreen: Base de datos Masterpiece */
.mp-db-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    background: rgba(12, 5, 26, 0.95);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 40px 20px;
    box-sizing: border-box;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    transform: translateY(0);
    opacity: 1;
    backdrop-filter: blur(12px);
}

.mp-db-modal.hidden {
    transform: translateY(100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.mp-db-container {
    width: 100%;
    max-width: 850px;
    background: rgba(26, 12, 50, 0.96);
    border: 1.5px solid rgba(255, 190, 26, 0.35);
    border-radius: 20px;
    padding: 24px 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
    margin: auto 0;
}

.mp-db-header {
    display: grid;
    grid-template-columns: 38px 1fr 38px;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 190, 26, 0.15);
    padding-bottom: 16px;
    width: 100%;
}

.mp-db-back-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mp-db-back-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: var(--neon-gold);
    color: var(--neon-gold);
}

.mp-db-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--neon-gold);
    margin: 0;
    letter-spacing: 0.5px;
    text-align: center;
}

.mp-db-pencil-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 190, 26, 0.12);
    border: 1px solid rgba(255, 190, 26, 0.35);
    color: var(--neon-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mp-db-pencil-btn:hover, .mp-db-pencil-btn.active {
    background: var(--neon-gold);
    color: #000;
    box-shadow: 0 0 10px rgba(255, 190, 26, 0.4);
}

/* Footer Actions */
.mp-db-footer-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 190, 26, 0.15);
}

.mp-db-footer-actions.hidden {
    display: none !important;
}

.btn-save-db {
    padding: 10px 24px;
    font-size: 0.85rem;
    font-weight: 800;
    border-radius: 10px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #ffffff !important;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-save-db:hover {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    box-shadow: 0 0 16px rgba(52, 211, 153, 0.5);
    transform: translateY(-1px);
}

.btn-reset-db {
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 10px;
    background: rgba(255, 77, 77, 0.15);
    border: 1px solid rgba(255, 77, 77, 0.35);
    color: #ff6b6b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-reset-db:hover {
    background: rgba(255, 77, 77, 0.25);
    border-color: #ff4d4d;
    color: #ffffff;
}

.mp-db-table-container {
    max-height: 60vh;
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 190, 26, 0.15);
    background: rgba(18, 7, 43, 0.4);
}

.mp-db-table {
    width: 100%;
    border-collapse: collapse;
}

.mp-db-table th {
    position: sticky;
    top: 0;
    background: rgba(30, 15, 58, 0.95);
    z-index: 10;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 2px solid rgba(255, 190, 26, 0.2);
}

.mp-db-table td {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
    vertical-align: middle;
}

.mp-db-row-material {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--text-white);
}

.mp-db-row-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

.mp-db-input {
    background: rgba(18, 7, 43, 0.85);
    border: 1px solid rgba(255, 190, 26, 0.4);
    border-radius: 6px;
    color: var(--text-white);
    font-weight: 700;
    padding: 5px 8px;
    width: 100%;
    max-width: 130px;
    font-size: 0.82rem;
    outline: none;
    transition: all 0.2s ease;
}

.mp-db-input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

body.light-theme .mp-db-modal {
    background: rgba(244, 241, 250, 0.95) !important;
}

body.light-theme .mp-db-container {
    background: #ffffff !important;
    border-color: rgba(142, 31, 167, 0.3) !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12) !important;
}

body.light-theme .mp-db-table th {
    background: #f4f1fa !important;
    color: #5e4c7d !important;
}

body.light-theme .mp-db-row-material {
    color: #1b0a3c !important;
}

body.light-theme .mp-db-input {
    background: #ffffff !important;
    border-color: rgba(142, 31, 167, 0.3) !important;
    color: #1b0a3c !important;
}

.mp-rec-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.mp-rec-winner-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mp-rec-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

.mp-rec-winner-name {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1.2;
}

.mp-rec-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--neon-gold);
    background: rgba(255, 190, 26, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 2px;
}

.mp-rec-value {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--text-white);
    line-height: 1.2;
}

.mp-rec-value.gold-text {
    color: var(--neon-gold);
}

.mp-rec-value.cyan-text {
    color: var(--neon-cyan);
}

.mp-rec-subvalue {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.mp-goal-empty-msg {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

/* Reglas de temas Normal y Light para mp-goal-card */
body.normal-style .mp-goal-card {
    background: var(--bg-medium-purple) !important;
    border-color: var(--bg-light-purple) !important;
    box-shadow: none !important;
}

body.normal-style .mp-goal-icon {
    background: var(--bg-light-purple) !important;
    border-color: var(--bg-light-purple) !important;
}

body.normal-style .mp-goal-title {
    background: none !important;
    -webkit-text-fill-color: initial !important;
    color: var(--text-white) !important;
}

body.normal-style .mp-goal-number-input {
    background: var(--bg-dark-purple) !important;
    border-color: var(--bg-light-purple) !important;
}

body.normal-style .mp-recommendation-panel {
    background: var(--bg-dark-purple) !important;
    border-color: var(--bg-light-purple) !important;
}

body.light-theme .mp-goal-card {
    background: #ffffff !important;
    border-color: rgba(142, 31, 167, 0.15) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .mp-goal-icon {
    background: rgba(142, 31, 167, 0.08) !important;
    border-color: rgba(142, 31, 167, 0.2) !important;
}

body.light-theme .mp-goal-title {
    color: #1b0a3c !important;
}

body.light-theme .mp-goal-number-input {
    background: #ffffff !important;
    border-color: rgba(142, 31, 167, 0.2) !important;
    color: #1b0a3c !important;
}

body.light-theme .mp-recommendation-panel {
    background: #f8f6fc !important;
    border-color: rgba(142, 31, 167, 0.12) !important;
}

body.light-theme .mp-rec-card {
    background: #ffffff !important;
    border-color: rgba(142, 31, 167, 0.08) !important;
}

body.light-theme .mp-rec-card.winner-card {
    background: rgba(255, 190, 26, 0.12) !important;
    border-color: rgba(255, 190, 26, 0.3) !important;
}

body.light-theme .mp-rec-winner-name,
body.light-theme .mp-rec-value {
    color: #1b0a3c !important;
}

body.light-theme .mp-rec-value.gold-text {
    color: #b8860b !important;
}

body.light-theme .mp-rec-value.cyan-text {
    color: #008b8b !important;
}

/* Acortar ancho de los selectores, quitar padding asimétrico y centrar el texto del recurso */
.custom-select-trigger.mp-search-trigger {
    min-width: 105px !important;
    max-width: 105px !important;
    padding: 6px 4px !important;
    text-align: center !important;
}

/* Asegurar centrado de inputs de texto de los desplegables cuando se escribe en ellos */
#masterpieces-tab-content .custom-select-trigger {
    text-align: center !important;
}

/* Clases de resaltado neón para destacar los valores de eficiencia en Masterpiece */
.mp-highlight-high {
    background: rgba(0, 219, 100, 0.15) !important;
    border: 1px solid var(--profit-green) !important;
    box-shadow: 0 0 8px rgba(0, 219, 100, 0.3) !important;
    border-radius: 4px;
    padding: 2px 6px;
    color: #2eff8e !important;
    font-weight: 700;
    display: inline-block;
}

.mp-highlight-wrapper {
    padding: 4px 6px !important;
}

/* Soporte de Modo Claro para los resaltados */
body.light-theme .mp-highlight-high {
    background: rgba(0, 180, 80, 0.12) !important;
    border-color: #00a84c !important;
    box-shadow: 0 0 6px rgba(0, 180, 80, 0.15) !important;
    color: #008f3f !important;
}

/* ==========================================================================
   SISTEMA DE DISEÑO SOBRIO (ESTILO NORMAL)
   ========================================================================== */

/* 1. Variables y Tokens para Estilo Normal (Oscuro y Claro) */
body.normal-style {
    --bg-dark-purple: #0a0a0a;
    --bg-medium-purple: #121212;
    --bg-light-purple: #262626;

    --neon-cyan: #ffffff;
    --neon-pink: #e5e5e5;
    --neon-purple: #d4d4d4;
    --neon-gold: #ffffff;

    --text-white: #ffffff;
    --text-muted: #888888;
    --text-dark: #0a0a0a;

    --profit-green: #22c55e;
    --loss-red: #ef4444;

    --font-heading: 'Inter', -apple-system, sans-serif;
}

body.normal-style.light-theme {
    --bg-dark-purple: #ffffff;
    --bg-medium-purple: #f5f5f5;
    --bg-light-purple: #e5e5e5;

    --neon-cyan: #171717;
    --neon-pink: #262626;
    --neon-purple: #404040;
    --neon-gold: #171717;

    --text-white: #171717;
    --text-muted: #737373;
    --text-dark: #ffffff;

    --profit-green: #16a34a;
    --loss-red: #dc2626;

    --font-heading: 'Inter', -apple-system, sans-serif;
}

/* 2. Anulación del fondo cuadriculado, gradiente y resplandores en modo normal */
body.normal-style {
    background-image: none !important;
}

body.normal-style::before {
    display: none !important;
}

/* Header & Logo sin resplandores ni rotaciones excesivas */
body.normal-style .header-logo {
    filter: none !important;
    animation: none !important;
}

body.normal-style .logo-title {
    background: none !important;
    -webkit-text-fill-color: initial !important;
    color: var(--text-white) !important;
}

body.normal-style .logo-subtitle {
    color: var(--text-muted) !important;
    text-shadow: none !important;
}

body.normal-style .app-header {
    border-bottom: 1px solid var(--bg-light-purple) !important;
    background: var(--bg-dark-purple) !important;
    box-shadow: none !important;
}

/* Botón Limpiar Todo */
body.normal-style .btn-clear-all {
    background: var(--bg-light-purple) !important;
    border-color: var(--bg-light-purple) !important;
    color: var(--text-white) !important;
    box-shadow: none !important;
}

body.normal-style .btn-clear-all:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

body.normal-style.light-theme .btn-clear-all:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}

/* Tarjetas y Paneles sin sombras de neón ni degradados complejos */
body.normal-style .calc-card,
body.normal-style .coin-card,
body.normal-style .factory-card,
body.normal-style .ws-card,
body.normal-style .factory-detail-card,
body.normal-style .ws-detail-card,
body.normal-style .detail-table-container,
body.normal-style .settings-modal-content,
body.normal-style .grid-panel {
    background: var(--bg-medium-purple) !important;
    border-color: var(--bg-light-purple) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    text-shadow: none !important;
}

/* Desplegables personalizados */
body.normal-style .custom-select,
body.normal-style .custom-select-trigger,
body.normal-style .custom-select-options-list {
    background: var(--bg-medium-purple) !important;
    border-color: var(--bg-light-purple) !important;
    color: var(--text-white) !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

body.normal-style .custom-select.main-resource-select {
    font-weight: 600 !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

body.normal-style .select-wrapper.active .custom-select-trigger {
    border-color: var(--text-white) !important;
}

body.normal-style .select-wrapper::after {
    border-top-color: var(--text-muted) !important;
}

body.normal-style .custom-select-option:hover {
    background: var(--bg-light-purple) !important;
    color: var(--text-white) !important;
}

body.normal-style .custom-select-option.selected {
    background: var(--bg-light-purple) !important;
    color: var(--text-white) !important;
}

/* Scrollbar */
body.normal-style ::-webkit-scrollbar-track {
    background: var(--bg-dark-purple) !important;
}

body.normal-style ::-webkit-scrollbar-thumb {
    background: var(--bg-light-purple) !important;
}

body.normal-style ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted) !important;
}

/* Barras de Total */
body.normal-style .total-cost-bar {
    background: rgba(255, 255, 255, 0.02) !important;
    border-color: var(--bg-light-purple) !important;
}

body.normal-style .total-cost-bar .total-summary-value {
    color: var(--text-white) !important;
    text-shadow: none !important;
}

body.normal-style .total-revenue-bar {
    background: rgba(34, 197, 94, 0.05) !important;
    border-color: rgba(34, 197, 94, 0.2) !important;
}

body.normal-style .total-revenue-bar .total-summary-value {
    color: var(--profit-green) !important;
    text-shadow: none !important;
}

body.normal-style.light-theme .total-cost-bar {
    background: rgba(0, 0, 0, 0.02) !important;
}

body.normal-style.light-theme .total-revenue-bar {
    background: rgba(22, 163, 74, 0.05) !important;
    border-color: rgba(22, 163, 74, 0.2) !important;
}

/* Coin pricing tracker */
body.normal-style .coin-symbol {
    text-shadow: none !important;
}

body.normal-style .coin-icon-wrapper {
    background: var(--bg-light-purple) !important;
    border: 1px solid var(--bg-light-purple) !important;
    box-shadow: none !important;
}

body.normal-style .coin-price-display {
    background: rgba(0, 0, 0, 0.15) !important;
    border-color: var(--bg-light-purple) !important;
}

body.normal-style.light-theme .coin-price-display {
    background: rgba(255, 255, 255, 0.8) !important;
}

body.normal-style .refresh-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--text-white) !important;
    box-shadow: none !important;
}

body.normal-style .refresh-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

body.normal-style.light-theme .refresh-btn {
    background: rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    color: var(--text-white) !important;
}

body.normal-style.light-theme .refresh-btn:hover {
    background: rgba(0, 0, 0, 0.08) !important;
}

/* Tarjeta de resultados (rentabilidad) */
body.normal-style .results-card {
    background: var(--bg-medium-purple) !important;
    border-color: var(--bg-light-purple) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

body.normal-style .results-card.positive {
    border-color: var(--profit-green) !important;
}

body.normal-style .results-card.negative {
    border-color: var(--loss-red) !important;
}

body.normal-style #results-card-glow {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

body.normal-style .result-glow-layer {
    display: none !important;
}

body.normal-style .results-indicator {
    text-shadow: none !important;
    border-radius: 4px !important;
}

body.normal-style .positive #net-profit-coins,
body.normal-style .positive #roi-value {
    color: var(--profit-green) !important;
    text-shadow: none !important;
}

body.normal-style .negative #net-profit-coins,
body.normal-style .negative #roi-value {
    color: var(--loss-red) !important;
    text-shadow: none !important;
}

/* Footer (Tab Bar) */
body.normal-style .app-footer {
    background: var(--bg-dark-purple) !important;
    border-top: 1px solid var(--bg-light-purple) !important;
    box-shadow: none !important;
}

body.normal-style .tab-item {
    color: var(--text-muted) !important;
}

body.normal-style .tab-item.active {
    color: var(--text-white) !important;
    border-top-color: var(--text-white) !important;
    background: none !important;
    text-shadow: none !important;
}

body.normal-style .tab-item:hover:not(.disabled) {
    color: var(--text-white) !important;
}

/* Banners Hero e Iconos */
body.normal-style .fact-hero-banner,
body.normal-style .ws-hero-banner {
    background: var(--bg-medium-purple) !important;
    border-color: var(--bg-light-purple) !important;
}

body.normal-style .fact-hero-icon,
body.normal-style .ws-hero-icon {
    background: var(--bg-light-purple) !important;
    border-color: var(--bg-light-purple) !important;
    color: var(--text-white) !important;
}

body.normal-style .fact-hero-title,
body.normal-style .ws-hero-title {
    background: none !important;
    -webkit-text-fill-color: initial !important;
    color: var(--text-white) !important;
}

body.normal-style .fact-stat-chip,
body.normal-style .ws-stat-chip {
    background: var(--bg-light-purple) !important;
    border-color: var(--bg-light-purple) !important;
}

body.normal-style .fact-stat-value,
body.normal-style .ws-stat-value {
    color: var(--text-white) !important;
    text-shadow: none !important;
}

/* Tablas y grids en Factories / Workshops / Mastery */
body.normal-style .detail-table th {
    background: var(--bg-light-purple) !important;
    border-bottom-color: var(--bg-light-purple) !important;
    color: var(--text-white) !important;
}

body.normal-style .detail-table td {
    border-bottom-color: var(--bg-light-purple) !important;
}

body.normal-style .detail-table tr:hover td {
    background: rgba(255, 255, 255, 0.02) !important;
}

body.normal-style.light-theme .detail-table tr:hover td {
    background: rgba(0, 0, 0, 0.02) !important;
}

body.normal-style .table-level-badge {
    background: var(--bg-light-purple) !important;
    border-color: var(--bg-light-purple) !important;
    color: var(--text-white) !important;
}

body.normal-style .table-upgrade-cost {
    color: var(--text-white) !important;
}

body.normal-style .detail-level-row {
    background: var(--bg-medium-purple) !important;
    border-color: var(--bg-light-purple) !important;
}

body.normal-style .detail-level-row:hover {
    background: var(--bg-light-purple) !important;
}

body.normal-style .level-row-badge {
    background: var(--bg-light-purple) !important;
    border-color: var(--bg-light-purple) !important;
    color: var(--text-white) !important;
}

body.normal-style .level-profit-badge.positive {
    background: rgba(34, 197, 94, 0.1) !important;
    color: var(--profit-green) !important;
    border-color: var(--profit-green) !important;
}

body.normal-style .level-profit-badge.negative {
    background: rgba(239, 68, 68, 0.1) !important;
    color: var(--loss-red) !important;
    border-color: var(--loss-red) !important;
}

body.normal-style .level-profit-badge.neutral {
    background: var(--bg-light-purple) !important;
    color: var(--text-muted) !important;
    border-color: var(--bg-light-purple) !important;
}

body.normal-style .io-box {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: var(--bg-light-purple) !important;
}

body.normal-style .io-box.output {
    color: var(--text-white) !important;
    border-color: var(--bg-light-purple) !important;
}

/* Tarjetas de Fábrica (Hover) */
body.normal-style .factory-card:hover {
    border-color: var(--text-muted) !important;
    box-shadow: none !important;
}

body.normal-style .factory-card::before,
body.normal-style .factory-card::after {
    display: none !important;
}

/* Tarjetas de Workshop (Hover) */
body.normal-style .ws-card::after {
    display: none !important;
}

body.normal-style .ws-card:hover {
    border-color: var(--text-muted) !important;
    box-shadow: none !important;
}

body.normal-style .ws-card-levels-badge {
    background: var(--bg-light-purple) !important;
    border-color: var(--bg-light-purple) !important;
    color: var(--text-white) !important;
}

body.normal-style .ws-card-bonus-badge {
    background: rgba(34, 197, 94, 0.1) !important;
    border-color: rgba(34, 197, 94, 0.2) !important;
    color: var(--profit-green) !important;
}

body.normal-style .ws-card-bar-fill {
    background: var(--profit-green) !important;
    box-shadow: none !important;
}

body.normal-style .ws-card-arrow {
    color: var(--text-white) !important;
}

body.normal-style .ws-card-img-wrapper {
    background: var(--bg-light-purple) !important;
    border-color: var(--bg-light-purple) !important;
}

body.normal-style .ws-detail-img-box {
    background: var(--bg-medium-purple) !important;
    border-color: var(--bg-light-purple) !important;
    box-shadow: none !important;
}

body.normal-style .ws-detail-info-row {
    background: var(--bg-medium-purple) !important;
    border-color: var(--bg-light-purple) !important;
}

/* Pestaña de Masterpiece */
body.normal-style #mp-calculator-table th {
    color: var(--text-white) !important;
    border-bottom-color: var(--bg-light-purple) !important;
}

body.normal-style #mp-calculator-table tr:hover {
    background: rgba(255, 255, 255, 0.02) !important;
}

body.normal-style.light-theme #mp-calculator-table tr:hover {
    background: rgba(0, 0, 0, 0.02) !important;
}

body.normal-style #mp-calculator-table .price-input {
    background: rgba(0, 0, 0, 0.15) !important;
    border-color: var(--bg-light-purple) !important;
}

body.normal-style.light-theme #mp-calculator-table .price-input {
    background: #ffffff !important;
}

body.normal-style #mp-calculator-table .price-input:focus {
    border-color: var(--text-white) !important;
    box-shadow: none !important;
}

body.normal-style .mp-highlight-high {
    background: rgba(34, 197, 94, 0.1) !important;
    border: 1px solid var(--profit-green) !important;
    box-shadow: none !important;
    color: var(--profit-green) !important;
}

body.normal-style .custom-select-trigger.mp-search-trigger {
    background: rgba(0, 0, 0, 0.15) !important;
    border-color: var(--bg-light-purple) !important;
}

body.normal-style.light-theme .custom-select-trigger.mp-search-trigger {
    background: #ffffff !important;
}

body.normal-style .select-wrapper.active .custom-select-trigger.mp-search-trigger {
    border-color: var(--text-white) !important;
    box-shadow: none !important;
}

/* Modal de Ajustes switches */
body.normal-style .settings-modal-content {
    background: var(--bg-medium-purple) !important;
    border-color: var(--bg-light-purple) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25) !important;
}

body.normal-style .theme-switch-container {
    background: var(--bg-dark-purple) !important;
    border-color: var(--bg-light-purple) !important;
}

body.normal-style .theme-label-text.active-dark {
    color: var(--text-white) !important;
    text-shadow: none !important;
}

body.normal-style .theme-label-text.active-light {
    color: var(--text-white) !important;
    text-shadow: none !important;
}

body.normal-style .slider {
    background-color: var(--bg-light-purple) !important;
    border-color: var(--bg-light-purple) !important;
}

body.normal-style .switch input:checked + .slider {
    background-color: var(--bg-light-purple) !important;
    border-color: var(--text-white) !important;
}

body.normal-style .switch input:checked + .slider:before {
    background-color: var(--text-white) !important;
    box-shadow: none !important;
    transform: translateX(24px) !important;
}

body.normal-style.light-theme .switch input:checked + .slider {
    background-color: var(--bg-light-purple) !important;
    border-color: var(--text-white) !important;
}

body.normal-style.light-theme .switch input:checked + .slider:before {
    background-color: var(--text-white) !important;
}

/* ==========================================================================
   PANTALLA COMPLETA DE PRECIOS LIVE (DESLIZABLE)
   ========================================================================== */
#coin-price-card {
    cursor: pointer !important;
}

.prices-screen {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark-purple);
    background-image: radial-gradient(circle at 50% 50%, var(--bg-medium-purple) 0%, var(--bg-dark-purple) 100%);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(100%);
}

.prices-screen.active {
    transform: translateY(0);
}

/* Rejilla de Fondo en pantalla de precios si estamos en Neon */
.prices-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(224, 86, 253, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(224, 86, 253, 0.03) 1px, transparent 1px);
    background-size: 24px 24px;
    z-index: -1;
    pointer-events: none;
}

body.normal-style .prices-screen {
    background-image: none !important;
    background-color: var(--bg-dark-purple) !important;
}

body.normal-style .prices-screen::before {
    display: none !important;
}

.prices-screen-header {
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 16px 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    border-bottom: 1px solid rgba(224, 86, 253, 0.2);
}

body.light-theme .prices-screen-header {
    border-bottom-color: rgba(142, 31, 167, 0.18);
}

body.normal-style .prices-screen-header {
    border-bottom-color: var(--bg-light-purple) !important;
}

.prices-screen-header-top {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.prices-screen-header-bottom {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.prices-screen-header h2 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-white);
    background: linear-gradient(90deg, #ffffff 0%, var(--neon-cyan) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    justify-self: center;
    text-align: center;
    margin: 0;
}

body.light-theme .prices-screen-header h2 {
    background: none !important;
    -webkit-text-fill-color: initial !important;
    color: var(--neon-cyan) !important;
}

body.normal-style .prices-screen-header h2 {
    background: none !important;
    -webkit-text-fill-color: initial !important;
    color: var(--text-white) !important;
}

#prices-settings-btn {
    justify-self: end;
    margin-left: auto;
}

#refresh-prices-screen-btn {
    width: auto;
    height: 32px;
    padding: 0 14px;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-ui);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.currency-toggle-btn {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    color: var(--neon-cyan);
    height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-ui);
    transition: all 0.2s ease;
}

.currency-toggle-btn:hover {
    background: rgba(0, 255, 255, 0.25);
    color: var(--text-white);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

.currency-toggle-btn:active {
    transform: scale(0.92);
}

body.normal-style .currency-toggle-btn {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--text-white) !important;
    box-shadow: none !important;
}

body.normal-style .currency-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

body.normal-style.light-theme .currency-toggle-btn {
    background: rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    color: var(--text-white) !important;
}

body.normal-style.light-theme .currency-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.08) !important;
}

.prices-screen-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    justify-self: start;
}

.prices-screen-close:hover {
    color: var(--neon-pink);
    transform: scale(1.1);
}

.prices-screen-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 40px 16px;
    max-width: 700px;
    width: 100%;
    margin: 0 auto;
}

.prices-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 480px) {
    .prices-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.price-item-card {
    background: rgba(43, 19, 78, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(224, 86, 253, 0.12);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: all 0.25s ease;
}

body.light-theme .price-item-card {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(142, 31, 167, 0.18);
}

body.normal-style .price-item-card {
    background: var(--bg-medium-purple) !important;
    border-color: var(--bg-light-purple) !important;
    box-shadow: none !important;
}

.price-item-card:hover {
    transform: translateY(-2px);
    border-color: rgba(224, 86, 253, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body.normal-style .price-item-card:hover {
    transform: none !important;
    border-color: var(--text-muted) !important;
    box-shadow: none !important;
}

.price-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.price-item-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.price-item-info {
    display: flex;
    flex-direction: column;
}

.price-item-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-white);
}

.price-item-symbol {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.price-item-values {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.price-item-values .price-item-usd.primary {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-white) !important;
}

.price-item-values .price-item-usd.secondary {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted) !important;
}

.price-item-values .price-item-coin.primary {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--neon-gold) !important;
}

.price-item-values .price-item-coin.secondary {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--neon-gold) !important;
}

body.light-theme .price-item-values .price-item-coin {
    color: #b8860b !important;
}

/* Toast Notification (Capsule-shaped message popup at the bottom) */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(30, 9, 60, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--neon-cyan);
    padding: 10px 20px;
    border-radius: 50px;
    color: var(--text-white);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 9999;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3), inset 0 0 10px rgba(0, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    opacity: 0;
}

.toast-container.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    color: var(--neon-cyan);
    display: flex;
    align-items: center;
}

body.normal-style .toast-container {
    background: #1e093c;
    border-color: var(--bg-light-purple);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.normal-style .toast-icon {
    color: var(--profit-green);
}

/* ==========================================================================
   RESPONSIVE FOUNDATION - DESKTOP, TABLET AND ANDROID
   ========================================================================== */

:root {
    --content-readable: 780px;
    --content-wide: 1120px;
    --touch-target: 44px;
}

html {
    min-width: 320px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-height: 100dvh;
}

button,
a,
input,
select,
.custom-select-trigger {
    touch-action: manipulation;
}

:where(button, a, input, select, .custom-select-trigger):focus-visible {
    outline: 3px solid var(--neon-cyan);
    outline-offset: 3px;
}

.app-header {
    height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
}

.header-container {
    height: var(--header-height);
    max-width: var(--content-wide);
}

.app-content {
    max-width: var(--content-readable);
    padding-top: calc(var(--header-height) + env(safe-area-inset-top, 0px) + 16px);
    padding-bottom: calc(var(--footer-height) + env(safe-area-inset-bottom, 0px) + 24px);
}

.app-footer {
    height: calc(var(--footer-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tab-bar {
    height: var(--footer-height);
    max-width: 900px;
}

.toast-container {
    bottom: calc(var(--footer-height) + env(safe-area-inset-bottom, 0px) + 16px);
    width: max-content;
    max-width: calc(100vw - 24px);
    text-align: center;
}

.settings-btn,
.settings-modal-close,
.prices-screen-close,
.mp-db-back-btn,
.mp-db-pencil-btn,
.mp-counter-btn {
    min-width: var(--touch-target);
    min-height: var(--touch-target);
}

.settings-btn,
.settings-modal-close,
.prices-screen-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn {
    width: var(--touch-target);
    height: var(--touch-target);
    flex: 0 0 var(--touch-target);
}

.btn-clear-all,
.btn-secondary-action,
.btn-primary,
.btn-save-db,
.btn-reset-db,
.currency-toggle-btn,
#refresh-prices-screen-btn {
    min-height: var(--touch-target);
}

.factory-search-input,
.ws-search-input,
.custom-select-trigger,
.price-input {
    min-height: 46px;
}

.detail-table-container,
.mp-db-table-container {
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.mp-db-table-container {
    overflow: auto;
}

.mp-db-table {
    min-width: 620px;
}

.mp-contributions-card {
    padding: 16px;
}

.mp-contributions-header {
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 0 12px;
    border-bottom: 1px solid rgba(224, 86, 253, 0.12);
    border-radius: 0;
}

.mp-contributions-title {
    font-size: 0.95rem;
}

.mp-contributions-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.mp-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mp-action-edit {
    background: rgba(224, 86, 253, 0.15);
    border: 1px solid rgba(224, 86, 253, 0.4);
    color: var(--neon-purple);
}

.mp-action-database {
    background: rgba(0, 255, 255, 0.12);
    border: 1px solid rgba(0, 255, 255, 0.35);
    color: var(--neon-cyan);
}

.horizontal-scroll-hint {
    display: none;
    margin: 0 0 8px;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.4;
}

.mp-table-scroll {
    width: 100%;
    overflow-x: auto;
    background: rgba(30, 15, 58, 0.35);
    border-color: rgba(255, 190, 26, 0.15);
}

#mp-calculator-table {
    min-width: 820px;
    font-size: 0.8rem;
}

@media (min-width: 768px) {
    :root {
        --header-height: 72px;
        --footer-height: 78px;
    }

    .app-content {
        max-width: 900px;
        padding-left: 24px;
        padding-right: 24px;
    }

    .app-content:has(#factories-tab-content:not(.hidden)),
    .app-content:has(#workshops-tab-content:not(.hidden)),
    .app-content:has(#mastery-tab-content:not(.hidden)) {
        max-width: var(--content-wide);
    }

    .app-content:has(#masterpieces-tab-content:not(.hidden)) {
        max-width: 1180px !important;
    }

    .factories-grid {
        grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    }

    .ws-grid {
        grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    }

    .prices-screen-header,
    .prices-screen-body {
        max-width: 900px;
    }
}

@media (max-width: 767px) {
    .app-content {
        padding-left: max(14px, env(safe-area-inset-left, 0px));
        padding-right: max(14px, env(safe-area-inset-right, 0px));
    }

    .card-header {
        padding: 14px 16px;
    }

    .results-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px 10px;
    }

    .results-grid .result-box:last-child {
        grid-column: 1 / -1;
    }

    .mp-goal-controls {
        display: grid;
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .mp-control-group {
        width: 100%;
        align-items: stretch;
    }

    .mp-goal-number-input,
    .mp-control-group .select-wrapper,
    .mp-control-group .select-wrapper .custom-select-trigger {
        width: 100% !important;
        height: 48px !important;
        min-height: 48px !important;
    }

    .mp-recommendation-panel {
        gap: 10px;
        padding: 14px;
    }

    .mp-rec-card {
        height: auto;
        min-height: 76px;
    }

    .mp-contributions-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .mp-contributions-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mp-contributions-actions #mp-clear-btn {
        grid-column: 1 / -1;
    }

    .mp-action-btn {
        width: 100%;
        min-height: 46px;
        white-space: normal;
    }

    .horizontal-scroll-hint {
        display: block;
    }

    #mp-calculator-table {
        min-width: 760px;
        font-size: 0.75rem;
    }

    #mp-calculator-table .price-input,
    #mp-calculator-table .custom-select-trigger {
        min-height: var(--touch-target) !important;
        height: var(--touch-target) !important;
    }

    .settings-modal {
        align-items: flex-end;
    }

    .settings-modal-content,
    #mp-edit-list-modal .settings-modal-content {
        width: 100% !important;
        max-width: none !important;
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 12px);
        overflow-y: auto;
        border-radius: 20px 20px 0 0;
    }

    #settings-modal .settings-modal-content {
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 12px);
    }

    #settings-modal .settings-dashboard {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    #settings-modal .app-version-card {
        grid-column: auto;
    }

    .settings-modal-body,
    #mp-edit-list-modal .settings-modal-body {
        padding: 18px max(18px, env(safe-area-inset-right, 0px)) max(18px, env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)) !important;
    }

    .mp-db-modal {
        padding: max(8px, env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    }

    .mp-db-container {
        max-width: none;
        margin: 0;
        padding: 16px 12px;
        border-radius: 16px;
    }

    .mp-db-header {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        gap: 8px;
        margin-bottom: 14px;
        padding-bottom: 12px;
    }

    .mp-db-title {
        font-size: clamp(0.9rem, 4vw, 1.1rem);
        overflow-wrap: anywhere;
    }

    .mp-db-footer-actions {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .mp-db-footer-actions button {
        width: 100%;
    }
}

@media (max-width: 599px) {
    :root {
        --header-height: 60px;
        --footer-height: 70px;
    }

    .header-container {
        padding: 0 10px 0 14px;
    }

    .header-status {
        padding: 0;
    }

    .logo-title {
        font-size: 0.9rem;
    }

    .logo-subtitle {
        font-size: 0.55rem;
        letter-spacing: 2px;
    }

    .coin-card {
        gap: 8px;
        padding: 12px;
    }

    .coin-info-left,
    .coin-price-right {
        gap: 8px;
        min-width: 0;
    }

    .coin-icon-wrapper {
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
    }

    .coin-symbol {
        font-size: 0.78rem;
    }

    .coin-network {
        font-size: 0.62rem;
    }

    .coin-price-display,
    .coin-price-value {
        min-width: 0;
        padding: 6px 8px;
        font-size: 0.86rem;
        white-space: nowrap;
    }

    .calc-card {
        border-radius: 16px;
    }

    .custom-select-trigger {
        padding-left: 12px;
        padding-right: 36px;
        font-size: 0.82rem;
    }

    .mp-contributions-card {
        padding: 12px;
    }

    .tab-bar {
        padding: 0 2px;
    }

    .tab-item {
        min-width: 0;
        min-height: var(--touch-target);
        gap: 3px;
    }

    .tab-label {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: clamp(0.47rem, 2.3vw, 0.58rem);
    }

    .prices-screen-header {
        gap: 14px;
        padding: max(14px, env(safe-area-inset-top, 0px)) 12px 16px;
    }

    .prices-screen-header h2 {
        font-size: 0.9rem;
    }

    .prices-screen-header-bottom {
        gap: 8px;
    }

    #refresh-prices-screen-btn,
    .currency-toggle-btn {
        flex: 1 1 0;
        min-width: 0;
        padding: 0 8px;
        font-size: 0.7rem;
    }

    .prices-screen-body {
        padding: 12px max(12px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
    }

    .price-item-card {
        padding: 12px;
    }
}

@media (max-width: 359px) {
    .app-content {
        padding-left: 10px;
        padding-right: 10px;
    }

    .custom-select-trigger.main-resource-select {
        padding-left: 8px;
        padding-right: 30px;
        font-size: 0.72rem;
        letter-spacing: 0;
    }

    .coin-card {
        padding: 10px;
    }

    .coin-network {
        display: none;
    }

    .coin-price-display,
    .coin-price-value {
        padding: 5px 6px;
        font-size: 0.74rem;
    }

    .card-title {
        font-size: 0.88rem;
    }

    .factories-grid {
        grid-template-columns: 1fr;
    }

    .mp-contributions-actions {
        grid-template-columns: 1fr;
    }

    .mp-contributions-actions #mp-clear-btn {
        grid-column: auto;
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    :root {
        --header-height: 54px;
        --footer-height: 60px;
    }

    .logo-subtitle,
    .tab-label {
        display: none;
    }
}

/* ==========================================================================
   ADMIN AUTHENTICATION
   ========================================================================== */

.admin-access-card {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid rgba(0, 255, 255, 0.18);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.18);
}

.admin-access-heading,
.admin-session-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-access-heading > div {
    display: grid;
    gap: 5px;
}

.admin-auth-status {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.admin-auth-status[data-state="admin"] {
    color: var(--profit-green);
}

.admin-auth-status[data-state="forbidden"],
.admin-auth-status[data-state="error"] {
    color: var(--loss-red);
}

.admin-status-dot {
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
    border-radius: 999px;
    background: var(--text-muted);
    box-shadow: 0 0 8px currentColor;
}

.admin-access-card:has(.admin-auth-status[data-state="admin"]) .admin-status-dot {
    color: var(--profit-green);
    background: var(--profit-green);
}

.admin-access-card:has(.admin-auth-status[data-state="forbidden"], .admin-auth-status[data-state="error"]) .admin-status-dot {
    color: var(--loss-red);
    background: var(--loss-red);
}

.admin-auth-description,
.admin-login-help {
    margin: 10px 0 14px;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.55;
}

.admin-auth-primary,
.admin-auth-secondary {
    min-height: var(--touch-target);
    border-radius: 9px;
    padding: 10px 14px;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

.admin-auth-primary {
    width: 100%;
    border: 1px solid rgba(0, 255, 255, 0.45);
    background: rgba(0, 255, 255, 0.12);
    color: var(--neon-cyan);
}

.admin-auth-secondary {
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-white);
}

.admin-auth-primary:disabled,
.admin-auth-secondary:disabled {
    cursor: wait;
    opacity: 0.65;
}

.admin-session-email {
    min-width: 0;
    overflow: hidden;
    color: var(--text-white);
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-login-content {
    width: min(92%, 420px);
}

.admin-login-form {
    display: grid;
    gap: 9px;
}

.admin-field-label {
    color: var(--text-white);
    font-size: 0.72rem;
    font-weight: 700;
}

.admin-field-input {
    width: 100%;
    min-height: 46px;
    border: 1px solid rgba(224, 86, 253, 0.3);
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.28);
    color: var(--text-white);
    padding: 10px 12px;
    font: inherit;
}

.admin-field-input:focus-visible {
    border-color: var(--neon-cyan);
    outline: 3px solid rgba(0, 255, 255, 0.25);
    outline-offset: 2px;
}

.admin-login-error {
    min-height: 1.2em;
    margin: 2px 0;
    color: var(--loss-red);
    font-size: 0.72rem;
    line-height: 1.4;
}

.admin-mfa-enrollment {
    display: grid;
    justify-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.admin-mfa-qr {
    width: min(220px, 75vw);
    height: auto;
    border: 10px solid #ffffff;
    border-radius: 10px;
    background: #ffffff;
}

.admin-mfa-secret-label {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 0.68rem;
    line-height: 1.4;
    text-align: center;
}

.admin-mfa-secret {
    max-width: 100%;
    overflow-wrap: anywhere;
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.28);
    color: var(--neon-cyan);
    padding: 8px 10px;
    font-size: 0.72rem;
    user-select: all;
}

.admin-mfa-code {
    letter-spacing: 0.35em;
    text-align: center;
}

body.light-theme .admin-access-card,
body.light-theme .admin-field-input {
    background: rgba(255, 255, 255, 0.72);
}

body.light-theme .admin-field-label,
body.light-theme .admin-session-email,
body.light-theme .admin-auth-secondary {
    color: var(--text-white);
}

@media (max-width: 599px) {
    .admin-session-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-session-email {
        width: 100%;
        text-align: center;
    }

    .admin-auth-secondary {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Editor administrativo de Supabase */
.admin-data-editor {
    z-index: 11000;
}

.admin-data-editor-content {
    display: flex;
    width: min(96vw, 1180px);
    max-width: 1180px;
    height: min(90dvh, 820px);
    flex-direction: column;
}

.admin-data-editor-body {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

.admin-editor-subtitle {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 0.68rem;
}

.admin-editor-toolbar {
    display: grid;
    grid-template-columns: minmax(190px, 0.8fr) minmax(240px, 1.2fr) auto auto;
    align-items: end;
    gap: 10px;
}

.admin-editor-control {
    display: grid;
    gap: 5px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
}

.admin-editor-toolbar .admin-auth-primary,
.admin-editor-toolbar .admin-auth-secondary,
.admin-row-action,
.admin-danger-button {
    min-height: 44px;
}

.admin-editor-feedback {
    display: flex;
    min-height: 24px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.72rem;
}

#admin-editor-status[data-state="success"] {
    color: var(--profit-green);
}

#admin-editor-status[data-state="error"] {
    color: var(--loss-red);
}

.admin-editor-table-container {
    min-height: 0;
    flex: 1;
    overflow: auto;
    border: 1px solid rgba(224, 86, 253, 0.22);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.18);
    overscroll-behavior: contain;
}

.admin-editor-table-container:focus-visible {
    outline: 3px solid rgba(0, 255, 255, 0.28);
    outline-offset: 2px;
}

.admin-data-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    color: var(--text-white);
    font-size: 0.72rem;
}

.admin-data-table caption {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.admin-data-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(30, 9, 60, 0.98);
    color: var(--neon-cyan);
    text-align: left;
}

.admin-data-table th,
.admin-data-table td {
    max-width: 280px;
    padding: 10px 12px;
    overflow: hidden;
    border-bottom: 1px solid rgba(224, 86, 253, 0.12);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-data-table tbody tr:hover {
    background: rgba(0, 255, 255, 0.05);
}

.admin-row-action {
    border: 1px solid rgba(0, 255, 255, 0.32);
    border-radius: 8px;
    background: rgba(0, 255, 255, 0.08);
    color: var(--neon-cyan);
    padding: 8px 14px;
    font-weight: 700;
    cursor: pointer;
}

.admin-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-reorder-button {
    width: 36px;
    min-width: 36px;
    min-height: 44px;
    border: 1px solid rgba(224, 86, 253, 0.34);
    border-radius: 8px;
    background: rgba(224, 86, 253, 0.08);
    color: var(--text-white);
    font: inherit;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
}

.admin-reorder-button:hover:not(:disabled) {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.admin-reorder-button:disabled {
    cursor: not-allowed;
    opacity: 0.28;
}

.admin-empty-state {
    padding: 28px !important;
    color: var(--text-muted);
    text-align: center;
}

.admin-record-modal {
    z-index: 12000;
}

.admin-record-content {
    display: flex;
    width: min(94vw, 760px);
    max-width: 760px;
    max-height: 88dvh;
    flex-direction: column;
}

.admin-record-form {
    display: flex;
    min-height: 0;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
}

.admin-record-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.admin-record-field {
    display: grid;
    min-width: 0;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
}

.admin-record-field:has(textarea) {
    grid-column: 1 / -1;
}

.admin-record-field textarea {
    min-height: 120px;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.72rem;
    line-height: 1.45;
}

.admin-record-field-checkbox {
    min-height: 46px;
    grid-template-columns: 1fr auto;
    align-items: center;
    border: 1px solid rgba(224, 86, 253, 0.3);
    border-radius: 9px;
    padding: 10px 12px;
}

.admin-record-field-checkbox .admin-field-input {
    width: 24px;
    min-height: 24px;
}

.admin-record-actions {
    display: flex;
    gap: 10px;
}

.admin-record-actions > * {
    flex: 1;
}

.admin-danger-button {
    border: 1px solid rgba(255, 73, 116, 0.5);
    border-radius: 9px;
    background: rgba(255, 73, 116, 0.12);
    color: var(--loss-red);
    padding: 10px 14px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.admin-danger-button:disabled {
    cursor: wait;
    opacity: 0.6;
}

.admin-delete-panel {
    display: grid;
    gap: 10px;
    border: 1px solid rgba(255, 73, 116, 0.36);
    border-radius: 10px;
    background: rgba(255, 73, 116, 0.07);
    padding: 12px;
}

.admin-delete-panel p {
    margin: 0;
    color: var(--loss-red);
    font-size: 0.72rem;
    line-height: 1.5;
}

body.light-theme .admin-editor-table-container,
body.light-theme .admin-delete-panel {
    background: rgba(255, 255, 255, 0.72);
}

body.light-theme .admin-data-table th {
    background: rgba(244, 236, 252, 0.98);
}

@media (max-width: 767px) {
    .admin-data-editor,
    .admin-record-modal {
        align-items: flex-end;
    }

    .admin-data-editor-content,
    .admin-record-content {
        width: 100%;
        max-width: none;
        height: min(94dvh, 900px);
        max-height: 94dvh;
        border-radius: 20px 20px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .admin-editor-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .admin-editor-control {
        grid-column: 1 / -1;
    }

    .admin-record-fields {
        grid-template-columns: 1fr;
    }

    .admin-record-field:has(textarea) {
        grid-column: auto;
    }
}

@media (max-width: 420px) {
    .admin-editor-toolbar,
    .admin-record-actions {
        display: flex;
        align-items: stretch;
        flex-direction: column;
    }

    .admin-editor-feedback {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
}
