/* Selector de tamaño */
.size-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.4rem;
}

.size-tab {
    flex: 1;
    padding: 0.65rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-soft);
    font-family: var(--font-primary);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.size-tab.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Matriz visual del sistema */
.sistema-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.4rem;
}

.ec-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: nowrap;
    background: var(--bg-soft);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 0.7rem 1rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.ec-row:focus-within {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.ec-num {
    font-family: var(--font-primary);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 28px;
    text-align: center;
}

.coef-inp {
    width: 58px;
    text-align: center;
    border: 1.5px solid var(--border-color);
    border-radius: 7px;
    padding: 0.42rem 0.3rem;
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    background: #fff;
    outline: none;
    transition: border-color var(--transition);
    flex-shrink: 0;
}

.coef-inp:focus {
    border-color: var(--secondary-color);
}

.coef-inp.term-ind {
    color: var(--accent-dark);
    border-color: #fcd34d;
    background: #fffbeb;
}

.ec-var {
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    white-space: nowrap;
}

.ec-op {
    font-family: var(--font-primary);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-dark);
    padding: 0 0.1rem;
}

.ec-igual {
    font-family: var(--font-primary);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    padding: 0 0.2rem;
}

/* Presets */
.presets-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.2rem;
}

.preset-chip {
    padding: 0.3rem 0.8rem;
    border: 1.5px solid var(--border-color);
    border-radius: 50px;
    background: var(--bg-soft);
    font-family: var(--font-primary);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.preset-chip:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Resultado */
.sol-wrap {
    display: grid;
    gap: 1rem;
    margin-top: 0.5rem;
}

.sol-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px;
    padding: 1.2rem 1.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sol-var {
    font-family: var(--font-primary);
    font-size: 1.1rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
}

.sol-val {
    font-family: 'Courier New', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.sol-decimal {
    font-family: var(--font-primary);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
}

.sol-card.sin-sol {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.sol-card.inf-sol {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
}

/* Pasos */
.pasos-lista {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.paso {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem 1.2rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

.paso-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-primary);
    font-size: 0.82rem;
    font-weight: 700;
    flex-shrink: 0;
}

.paso-body {
    flex: 1;
    min-width: 0;
}

.paso-titulo {
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.4rem;
}

.paso-formula {
    font-family: 'Courier New', monospace;
    font-size: 0.88rem;
    color: var(--primary-color);
    background: var(--bg-soft);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    display: block;
    margin: 0.2rem 0;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    white-space: pre;
}

.paso-resultado {
    font-family: var(--font-primary);
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    line-height: 1.5;
}

/* Determinante */
.det-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.7rem;
    margin-top: 0.5rem;
}

.det-card {
    background: var(--bg-soft);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    text-align: center;
}

.det-label {
    font-family: var(--font-primary);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.det-val {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Badge tipo de sistema */
.tipo-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-family: var(--font-primary);
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.badge-det {
    background: #d1fae5;
    color: #065f46;
}

.badge-indet {
    background: #ede9fe;
    color: #5b21b6;
}

.badge-incom {
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 580px) {
    .ec-row {
        gap: 0.25rem;
        padding: 0.6rem 0.5rem;
    }

    .coef-inp {
        width: 48px;
        font-size: 0.88rem;
        padding: 0.38rem 0.2rem;
    }

    .ec-var {
        font-size: 0.88rem;
    }

    .sol-val {
        font-size: 1.5rem;
    }
}